Patch "Revert "sched, cgroup: replace signal_struct->group_rwsem with a global percpu_rwsem"" has been added to the 4.2-stable tree
Subsystems (5)
This is a note to let you know that I've just added the patch titled
Revert "sched, cgroup: replace signal_struct->group_rwsem with a global percpu_rwsem"
to the 4.2-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
revert-sched-cgroup-replace-signal_struct-group_rwsem-with-a-global-percpu_rwsem.patch
and it can be found in the queue-4.2 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
0c986253b939cc14c69d4adbe2b4121bdf4aa220Mon Sep 17 00:00:00 2001
From: Tejun Heo <[email protected]>
Date: Wed, 16 Sep 2015 11:51:12 -0400
Subject: Revert "sched, cgroup: replace signal_struct->group_rwsem with a global percpu_rwsem"
From: Tejun Heo <[email protected]>
commit 0c986253b939cc14c69d4adbe2b4121bdf4aa220 upstream.
This reverts commit d59cfc09c32a2ae31f1c3bc2983a0cd79afb3f14.
d59cfc09c32a ("sched, cgroup: replace signal_struct->group_rwsem with a global percpu_rwsem") and b5ba75b5fc0e ("cgroup: simplify threadgroup locking") changed how cgroup synchronizes against task fork and exits so that it uses global percpu_rwsem instead of per-process rwsem; unfortunately, the write [un]lock paths of percpu_rwsem always involve synchronize_rcu_expedited() which turned out to be too expensive.
Improvements for percpu_rwsem are scheduled to be merged in the coming v4.4-rc1 merge window which alleviates this issue. For now, revert the two commits to restore per-process rwsem. They will be re-applied for the v4.4-rc1 merge window.
--- include/linux/cgroup-defs.h | 27 +-------------- include/linux/init_task.h | 8 ++++ include/linux/sched.h | 12 ++++++ kernel/cgroup.c | 77 ++++++++++++++++++++++++++++++++------------ kernel/fork.c | 4 ++ 5 files changed, 83 insertions(+), 45 deletions(-)
include/linux/cgroup-defs.h +2 -25
@@ -463,31 +463,8 @@ struct cgroup_subsys { unsigned int depends_on; }; -extern struct percpu_rw_semaphore cgroup_threadgroup_rwsem; - -/** -* cgroup_threadgroup_change_begin - threadgroup exclusion for cgroups -* @tsk: target task -* -* Called from threadgroup_change_begin() and allows cgroup operations to -* synchronize against threadgroup changes using a percpu_rw_semaphore. -*/ -static inline void cgroup_threadgroup_change_begin (struct task_struct *tsk) -{ -percpu_down_read (&cgroup_threadgroup_rwsem); -} - -/** -* cgroup_threadgroup_change_end - threadgroup exclusion for cgroups -* @tsk: target task -* -* Called from threadgroup_change_end(). Counterpart of -* cgroup_threadcgroup_change_begin(). -*/ -static inline void cgroup_threadgroup_change_end (struct task_struct *tsk) -{ -percpu_up_read (&cgroup_threadgroup_rwsem); -} +void cgroup_threadgroup_change_begin (struct task_struct *tsk); +void cgroup_threadgroup_change_end (struct task_struct *tsk);#else /* CONFIG_CGROUPS */
include/linux/init_task.h +8 -0
@@ -25,6 +25,13 @@extern struct files_struct init_files;extern struct fs_struct init_fs; +#ifdef CONFIG_CGROUPS +#define INIT_GROUP_RWSEM (sig) \ + .group_rwsem = __RWSEM_INITIALIZER(sig.group_rwsem), +#else +#define INIT_GROUP_RWSEM (sig) +#endif +#ifdef CONFIG_CPUSETS #define INIT_CPUSET_SEQ (tsk) \ .mems_allowed_seq = SEQCNT_ZERO(tsk.mems_allowed_seq),
@@ -48,6 +55,7 @@ extern struct fs_struct init_fs; }, \ .cred_guard_mutex = \ __MUTEX_INITIALIZER(sig.cred_guard_mutex), \ + INIT_GROUP_RWSEM(sig) \ }extern struct nsproxy init_nsproxy;
include/linux/sched.h +12 -0
@@ -754,6 +754,18 @@ struct signal_struct {unsigned audit_tty_log_passwd;struct tty_audit_buf *tty_audit_buf;#endif +#ifdef CONFIG_CGROUPS +/* +* group_rwsem prevents new tasks from entering the threadgroup and +* member tasks from exiting,a more specifically, setting of +* PF_EXITING. fork and exit paths are protected with this rwsem +* using threadgroup_change_begin/end(). Users which require +* threadgroup to remain stable should use threadgroup_[un]lock() +* which also takes care of exec path. Currently, cgroup is the +* only user. +*/ +struct rw_semaphore group_rwsem; +#endif oom_flags_t oom_flags;short oom_score_adj;/* OOM kill score adjustment */
kernel/cgroup.c +57 -20
157 lines not on this page · raw message
kernel/fork.c +4 -0
@@ -1146,6 +1146,10 @@ static int copy_signal(unsigned long clotty_audit_fork (sig);sched_autogroup_fork (sig); +#ifdef CONFIG_CGROUPS +init_rwsem (&sig->group_rwsem); +#endif + sig->oom_score_adj = current->signal->oom_score_adj; sig->oom_score_adj_min = current->signal->oom_score_adj_min;
Patches currently in stable-queue which might be from [email protected] are
queue-4.2/revert-cgroup-simplify-threadgroup-locking.patch queue-4.2/revert-sched-cgroup-replace-signal_struct-group_rwsem-with-a-global-percpu_rwsem.patch queue-4.2/block-blkg_destroy_all-should-clear-q-root_blkg-and-root_rl.blkg.patch