Skip to content

RFC percpu rwsem -v2

Peter Zijlstra lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest13 patches 88 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/13rcu: Create rcu_sync infrastructureinclude/linux/rcusync.h kernel/rcu/Makefile kernel/rcu/sync.c+173 -10 replies
2/13rcusync: Introduce struct rcu_sync_opsinclude/linux/rcusync.h kernel/rcu/sync.c+45 -580 replies
3/13rcusync: Add the CONFIG_PROVE_RCU checksinclude/linux/rcusync.h kernel/rcu/sync.c+27 -00 replies
4/13rcusync: Introduce rcu_sync_dtor()include/linux/rcusync.h kernel/rcu/sync.c+23 -00 replies
5/13percpu-rwsem: Optimize readers and reduce global impactinclude/linux/percpu-rwsem.h kernel/locking/percpu-rwsem.c+182 -1237 replies
6/13percpu-rwsem: Provide percpu_down_read_trylock()include/linux/percpu-rwsem.h kernel/locking/percpu-rwsem.c+29 -01 reply
7/13sched: Reorder task_structinclude/linux/sched.h+2 -30 replies
8/13percpu-rwsem: DEFINE_STATIC_PERCPU_RWSEMinclude/linux/percpu-rwsem.h+13 -00 replies
9/13hotplug: Replace hotplug lock with percpu-rwseminclude/linux/cpu.h include/linux/percpu-rwsem.h include/linux/sched.h +4 more+65 -9512 replies
10/13fs/locks: Replace lg_global with a percpu-rwsemfs/locks.c+18 -00 replies
11/13fs/locks: Replace lg_local with a per-cpu spinlockfs/Kconfig fs/locks.c+30 -181 reply
12/13stop_machine: Remove lglockkernel/stop_machine.c lib/Kconfig+35 -2251 replies
13/13locking: Remove lglockDocumentation/locking/lglock.txt fs/file_table.c include/linux/lglock.h +2 more+0 -3600 replies

Reviews trailers per patch

6 of 13 patches have a Reviewed-by or Acked-by.

PatchPaul E. McKenneyOleg Nesterov
1/13R-b
2/13R-b
3/13R-b
4/13R-b
5/13R-b
6/13R-b
7/13
8/13
9/13
10/13
11/13
12/13
13/13

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [RFC][PATCH 00/13] percpu rwsem -v2

This is a derived work of the cpu hotplug lock rework I did in 2013 which never really went anywhere because Linus didn't like it.

This applies those same optimizations to the percpu-rwsem. Seeing how we did all the work it seemed a waste to not use it at all. Linus still didn't like it because there was only a single user, there are two now:

- uprobes
- cgroups

This series converts the cpu hotplug lock into a percpu-rwsem to provide a 3rd user.

Also, since Linus thinks lglocks is a failed locking primitive (which I whole heartedly agree with, its preempt-disable latencies are an abomination), it also converts the global part of fs/locks's usage of lglock over to a percpu-rwsem and uses a per-cpu spinlock for the local part. This both provides another (4th) percpu-rwsem users and removes an lglock user.

It further removes the stop_machine lglock usage, and with it kills lglocks.

Changes since -v1:

- Added the missing smp_load_acquire()/smp_store_release() as spotted by Oleg
- Added percpu_down_read_trylock()
- Convert cpu hotplug lock
- Convert fs/locks
- Removes lglock from stop_machine
- Removes lglock

---
 Documentation/locking/lglock.txt | 166 -------------------------
 fs/Kconfig                       |   1 +
 fs/file_table.c                  |   1 -
 fs/locks.c                       |  65 +++++++---
 include/linux/cpu.h              |   6 +
 include/linux/lglock.h           |  81 -------------
 include/linux/percpu-rwsem.h     |  96 +++++++++++++--
 include/linux/sched.h            |   9 +-
 init/main.c                      |   1 +
 kernel/cpu.c                     | 130 ++++++--------------
 kernel/fork.c                    |   2 +
 kernel/locking/Makefile          |   1 -
 kernel/locking/lglock.c          | 111 -----------------
 kernel/locking/percpu-rwsem.c    | 255 +++++++++++++++++++++------------------
 kernel/rcu/Makefile              |   2 +-
 kernel/stop_machine.c            |  52 ++++----
 lib/Kconfig                      |  10 ++
 17 files changed, 371 insertions(+), 618 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in Please read the FAQ at http://www.tux.org/lkml/