V2: rwsem changes + down_read_unfair() proposal
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest10 patches 2 repliesIn review
Changes since v1 from the cover letter
- Keep the active count check when trying to wake readers in the up_xxxx() slow path (I had suppressed it in v1). However, I did try to lighten the check (this is patch 3 of the series).
- Added priviledge check before making use of unfair behavior in /proc/<pid>/exe and /proc/<pid>/maps files.
- Applied David Howell's many small suggestions (I hope I did not miss any).
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/10 | x86 rwsem: minor cleanupsarch/ | +8 | 0 replies | |
| 2/10 | rwsem: fully separate code pathes to wake writers vs readerslib/ | +31 | 0 replies | |
| 3/10 | rwsem: lighter active count checks when waking up readerslib/ | +33 | 0 replies | |
| 4/10 | rwsem: let RWSEM_WAITING_BIAS represent any number of waiting threadslib/ | +17 | 0 replies | |
| 5/10 | rwsem: wake queued readers when writer blocks on active read locklib/ | +16 | 0 replies | |
| 6/10 | rwsem: smaller wrappers around rwsem_down_failed_commonlib/ | +10 | 0 replies | |
| 7/10 | generic rwsem: implement down_read_unfairinclude/ include/ kernel/ +1 more | +43 | 0 replies | |
| 8/10 | rwsem: down_read_unfair infrastructure supportlib/ | +21 | 0 replies | |
| 9/10 | x86 rwsem: down_read_unfair implementationarch/ arch/ arch/ | +72 | 0 replies | |
| 10/10 | Use down_read_unfair() for /sys/<pid>/exe and /sys/<pid>/maps filesfs/ fs/ fs/ +3 more | +21 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH 00/10] V2: rwsem changes + down_read_unfair() proposal
I would like to sollicit comments regarding the following changes against 2.6.34-rc7 + 91af708 (from V1 proposal) already applied.
The motivation for this change was some cluster monitoring software we use at google; which reads /proc/<pid>/maps files for all running processes. When the machines are under load, the mmap_sem is often acquire for reads for long periods of time since do_page_fault() holds it while doing disk accesses; and fair queueing behavior often ends up in the monitoring software making little progress. By introducing unfair behavior in a few selected places, are are able to let the monitoring software make progress without impacting performance for the rest of the system.
In general, I've made sure to implement this proposal without touching the rwsem fast paths. Also, the first 8 patches of this series should be of general applicability even if not taking the down_read_unfair() changes, addressing minor issues such as situations where reader threads can get blocked at the head of the waiting list even though the rwsem is currently owned for reads.
Changes since v1:
- Keep the active count check when trying to wake readers in the up_xxxx() slow path (I had suppressed it in v1). However, I did try to lighten the check (this is patch 3 of the series).
- Added priviledge check before making use of unfair behavior in /proc/<pid>/exe and /proc/<pid>/maps files.
- Applied David Howell's many small suggestions (I hope I did not miss any).
Michel Lespinasse (10):
x86 rwsem: minor cleanups
rwsem: fully separate code pathes to wake writers vs readers
rwsem: lighter active count checks when waking up readers
rwsem: let RWSEM_WAITING_BIAS represent any number of waiting threads
rwsem: wake queued readers when writer blocks on active read lock
rwsem: smaller wrappers around rwsem_down_failed_common generic rwsem: implement down_read_unfair
rwsem: down_read_unfair infrastructure support
x86 rwsem: down_read_unfair implementation
Use down_read_unfair() for /sys/<pid>/exe and /sys/<pid>/maps files
arch/x86/include/asm/rwsem.h | 70 ++++++++++++----- arch/x86/lib/rwsem_64.S | 14 +++- arch/x86/lib/semaphore_32.S | 21 +++++- fs/proc/base.c | 2 +- fs/proc/task_mmu.c | 2 +- fs/proc/task_nommu.c | 2 +- include/linux/capability.h | 1 + include/linux/rwsem-spinlock.h | 10 ++- include/linux/rwsem.h | 13 +++ kernel/rwsem.c | 31 ++++++++ lib/rwsem-spinlock.c | 10 ++- lib/rwsem.c | 160 ++++++++++++++++++++++++++-------------- 12 files changed, 247 insertions(+), 89 deletions(-)