sched, cgroup: replace signal_struct->group_rwsem with a global percpu_rwsem
The cgroup side of threadgroup locking uses signal_struct->group_rwsem
to synchronize against threadgroup changes. This per-process rwsem
adds small overhead to thread creation, exit and exec paths, forces
cgroup code paths to do lock-verify-unlock-retry dance in a couple
places and makes it impossible to atomically perform operations across
multiple processes.
This patch replaces signal_struct->group_rwsem with a global
percpu_rwsem cgroup_threadgroup_rwsem which is cheaper on the reader
side and contained in cgroups proper. This patch converts one-to-one.
This does make writer side heavier and lower the granularity; however,
cgroup process migration is a fairly cold path, we do want to optimize
thread operations over it and cgroup migration operations don't take
enough time for the lower granularity to matter.
Signed-off-by:
Tejun Heo <tj@kernel.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Showing
- include/linux/cgroup-defs.h 25 additions, 2 deletionsinclude/linux/cgroup-defs.h
- include/linux/init_task.h 0 additions, 8 deletionsinclude/linux/init_task.h
- include/linux/sched.h 0 additions, 12 deletionsinclude/linux/sched.h
- init/Kconfig 1 addition, 0 deletionsinit/Kconfig
- kernel/cgroup.c 20 additions, 57 deletionskernel/cgroup.c
- kernel/fork.c 0 additions, 4 deletionskernel/fork.c
Loading
Please register or sign in to comment