linux/kernel/rcu
Peter Zijlstra 3942a9bd7b locking, rcu, cgroup: Avoid synchronize_sched() in __cgroup_procs_write()
The current percpu-rwsem read side is entirely free of serializing insns
at the cost of having a synchronize_sched() in the write path.

The latency of the synchronize_sched() is too high for cgroups. The
commit 1ed1328792 talks about the write path being a fairly cold path
but this is not the case for Android which moves task to the foreground
cgroup and back around binder IPC calls from foreground processes to
background processes, so it is significantly hotter than human initiated
operations.

Switch cgroup_threadgroup_rwsem into the slow mode for now to avoid the
problem, hopefully it should not be that slow after another commit:

  80127a3968 ("locking/percpu-rwsem: Optimize readers and reduce global impact").

We could just add rcu_sync_enter() into cgroup_init() but we do not want
another synchronize_sched() at boot time, so this patch adds the new helper
which doesn't block but currently can only be called before the first use.

Reported-by: John Stultz <john.stultz@linaro.org>
Reported-by: Dmitry Shmidt <dimitrysh@google.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Colin Cross <ccross@google.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rom Lemarchand <romlem@google.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Todd Kjos <tkjos@google.com>
Link: http://lkml.kernel.org/r/20160811165413.GA22807@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2016-08-18 15:36:59 +02:00
..
Makefile rcutorture: Add RCU grace-period performance tests 2016-03-31 13:37:38 -07:00
rcu.h tiny_rcu: Directly force QS when call_rcu_[bh|sched]() on idle_task 2015-01-06 11:01:12 -08:00
rcuperf.c rcutorture: Fix error return code in rcu_perf_init() 2016-06-14 16:03:32 -07:00
rcutorture.c Merge branches 'doc.2016.06.15a', 'fixes.2016.06.15b' and 'torture.2016.06.14a' into HEAD 2016-06-15 16:58:03 -07:00
srcu.c rcu: Add rcu_normal kernel parameter to suppress expediting 2015-12-04 12:26:53 -08:00
sync.c locking, rcu, cgroup: Avoid synchronize_sched() in __cgroup_procs_write() 2016-08-18 15:36:59 +02:00
tiny_plugin.h rcu: Make rcu/tiny_plugin.h explicitly non-modular 2016-02-23 19:59:55 -08:00
tiny.c rcu: Use rcu_callback_t in call_rcu*() and friends 2015-10-06 11:08:05 -07:00
tree_exp.h Merge branch 'locking-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2016-07-25 12:41:29 -07:00
tree_plugin.h Merge branches 'doc.2016.06.15a', 'fixes.2016.06.15b' and 'torture.2016.06.14a' into HEAD 2016-06-15 16:58:03 -07:00
tree_trace.c rcu: Shorten expedited_workdone* to exp_workdone* 2016-03-31 13:34:08 -07:00
tree.c rcu: Convert rcutree to hotplug state machine 2016-07-15 10:41:44 +02:00
tree.h rcu: Correctly handle sparse possible cpus 2016-06-15 16:00:05 -07:00
update.c rcu: Make call_rcu_tasks() tolerate first call with irqs disabled 2016-06-15 15:45:00 -07:00