binder: faster page installations
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v7 Latest9 patches 0 repliesNew
- v69 patches 5 repliesSuperseded
- v59 patches 7 repliesSuperseded
Earlier versions · 4
| Version | Posted | Patches | Replies | Status |
|---|---|---|---|---|
| v4 | 9 patches | 7 replies | Superseded | |
| v3 | 8 patches | 7 replies | Superseded | |
| v2 | 8 patches | 14 replies | Superseded | |
| v1 | 8 patches | 3 replies | Superseded |
Changes in v7 from the cover letter
* cast page->private to struct binder_shrinker_mdata before kfree()
Patches in v7 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/9 | Revert "binder: switch alloc->mutex to spinlock_t"drivers/ drivers/ | +28 | 0 replies | |
| 2/9 | binder: concurrent page installationdrivers/ | +41 | 0 replies | |
| 3/9 | binder: select correct nid for pages in LRUdrivers/ | +12 | 0 replies | |
| 4/9 | binder: store shrinker metadata under page->privatedrivers/ drivers/ drivers/ | +99 | 0 replies | |
| 5/9 | binder: replace alloc->vma with alloc->mappeddrivers/ drivers/ drivers/ | +30 | 0 replies | |
| 6/9 | binder: rename alloc->buffer to vm_startdrivers/ drivers/ drivers/ +2 more | +19 | 0 replies | |
| 7/9 | binder: use per-vma lock in page installationdrivers/ | +50 | 0 replies | |
| 8/9 | binder: propagate vm_insert_page() errorsdrivers/ | +0 | 0 replies | |
| 9/9 | binder: use per-vma lock in page reclaimingdrivers/ | +22 | 0 replies |
Reviews trailers per patch
All 9 patches have a Reviewed-by or Acked-by.
| Patch | Suren Baghdasaryan |
|---|---|
| 1/9 | R-b |
| 2/9 | R-b |
| 3/9 | R-b |
| 4/9 | R-b |
| 5/9 | R-b |
| 6/9 | R-b |
| 7/9 | R-b |
| 8/9 | R-b |
| 9/9 | R-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH v7 0/9] binder: faster page installations
The main focus of these patches is to improve the performance of binder page installations, primarily by reducing contention on the mmap_lock. The idea is to allow concurrent page insertion by leveraging per-vma locking and get_user_pages_remote().
Unfortunately, this required reverting the alloc->lock spinlock back into a mutex in order to serialize with the shrinker. At least until finding a better solution e.g. support page zapping with a spinlock. The trade off is still quite worth it though.
Other patches are also included that remove unsafe and redundant things such as the alloc->vma pointer or the struct binder_lru_page concept.
Note: I'll work on setting up a page fault handler for binder next. I believe an idea from Alice Ryhl to deferred the page insertions will make this finally feasible. I only need to figure out a few performance bits but if/when done most of the manual page insertion code in binder could be dropped. :)
Changelog:
v7:
* cast page->private to struct binder_shrinker_mdata before kfree()
v6:
https://lore.kernel.org/all/[email protected]/
* rework the usage of page->lru and page->index into only page->private
* expanded comments aobut vma validation using alloc->mapped per Suren
v5:
https://lore.kernel.org/all/[email protected]/
* rebase and resolve conflicts with commit da0c02516c50 ("mm/list_lru:
simplify the list_lru walk callback function")
* add comment to binder_alloc_is_mapped() about valid vma check
* add note to commit log about future page->lru removal
* collect Reviewed-by tags from Suren
v4:
https://lore.kernel.org/all/[email protected]/
* add explicit FOLL_NOFAULT to get_user_pages_remote()
* per-vma locking to shrinker path (per Liam)
v3:
https://lore.kernel.org/all/[email protected]/
* collect "Reviewed-by" tags from Suren
* use full commit subject in revert (not only sha1)
* add "goto unlock" label for vma_lookup() failures
* address -ENOMEM error override in separate patch
* squash "remove alloc->vma" patch into alloc->mapped patch
* pass 'struct binder_alloc *' to binder_page_lookup() too
* factor out individual mmget_not_zero()/mmput_async() calls
* cleanup binder_page_insert() to avoid using goto
* document only one mapping allowed per binder instance
* check binder_alloc_is_mapped() in binder_page_lookup()
* remove no longer need local page_to_free pointer
v2:
https://lore.kernel.org/all/[email protected]/
* fix locking order when upgrading from vma lock to mmap lock
* switch folio_walk_start() for get_user_pages_remote()
* release vma/mmap locks and mmput() right after vm_insert_page()
* add binder_page_alloc() helper for binder_install_single_page()
v1:
https://lore.kernel.org/all/[email protected]/
Carlos Llamas (9):
Revert "binder: switch alloc->mutex to spinlock_t"
binder: concurrent page installation
binder: select correct nid for pages in LRU
binder: store shrinker metadata under page->private
binder: replace alloc->vma with alloc->mapped
binder: rename alloc->buffer to vm_start
binder: use per-vma lock in page installation
binder: propagate vm_insert_page() errors
binder: use per-vma lock in page reclaiming
drivers/android/binder.c | 2 +- drivers/android/binder_alloc.c | 366 +++++++++++++++--------- drivers/android/binder_alloc.h | 45 +-- drivers/android/binder_alloc_selftest.c | 18 +- drivers/android/binder_trace.h | 2 +- 5 files changed, 269 insertions(+), 164 deletions(-)
Signature · 1 line
2.47.0.338.g60cca15819-goog