sched, cgroup: reorganize threadgroup locking
authorTejun Heo <tj@kernel.org>
Wed, 13 May 2015 20:35:16 +0000 (16:35 -0400)
committerSasha Levin <alexander.levin@verizon.com>
Thu, 8 Jun 2017 02:52:05 +0000 (22:52 -0400)
commit034dd596324d53e0d7dd9a7a3f3290e6982eb1b4
tree2efecb70263aba26772b24a7a2666411610dbbd3
parent0e521eabd7a3e1c5efb57f1dd8e3721e319a9bc1
sched, cgroup: reorganize threadgroup locking

[ Upstream commit 7d7efec368d537226142cbe559f45797f18672f9 ]

threadgroup_change_begin/end() are used to mark the beginning and end
of threadgroup modifying operations to allow code paths which require
a threadgroup to stay stable across blocking operations to synchronize
against those sections using threadgroup_lock/unlock().

It's currently implemented as a general mechanism in sched.h using
per-signal_struct rwsem; however, this never grew non-cgroup use cases
and becomes noop if !CONFIG_CGROUPS.  It turns out that cgroups is
gonna be better served with a different sycnrhonization scheme and is
a bit silly to keep cgroups specific details as a general mechanism.

What's general here is identifying the places where threadgroups are
modified.  This patch restructures threadgroup locking so that
threadgroup_change_begin/end() become a place where subsystems which
need to sycnhronize against threadgroup changes can hook into.

cgroup_threadgroup_change_begin/end() which operate on the
per-signal_struct rwsem are created and threadgroup_lock/unlock() are
moved to cgroup.c and made static.

This is pure reorganization which doesn't cause any functional
changes.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
include/linux/cgroup-defs.h
include/linux/sched.h
kernel/cgroup.c