]> rtime.felk.cvut.cz Git - hercules2020/nv-tegra/linux-4.4.git/commit
locking, rcu, cgroup: Avoid synchronize_sched() in __cgroup_procs_write()
authorPeter Zijlstra <peterz@infradead.org>
Thu, 11 Aug 2016 16:54:13 +0000 (18:54 +0200)
committermobile promotions <svcmobile_promotions@nvidia.com>
Wed, 14 Jun 2017 11:31:25 +0000 (04:31 -0700)
commitc8ba94ba02edc3cc9b3c898ecf37c6739401b774
treefe35ee260ce539a56883de1cd1874826ad58b431
parent3e761bdf659760577d2aa9e4216d365ec7ee5e98
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 1ed1328792ff 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:

  80127a39681b ("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.

Bug 200300548

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>
(cherry picked from upstream commit 3942a9bd7b5842a924e99ee6ec1350b8006c94ec)

Conflicts:
kernel/cgroup.c

Change-Id: Ic43990317727692975699676775ca7b1ea0dd9b9
Signed-off-by: Sai Gurrappadi <sgurrappadi@nvidia.com>
Reviewed-on: http://git-master/r/1494853
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
include/linux/rcu_sync.h
kernel/cgroup.c
kernel/rcu/sync.c