• Tejun Heo's avatar
    cgroup: Make !percpu threadgroup_rwsem operations optional · 6a010a49
    Tejun Heo authored
    3942a9bd ("locking, rcu, cgroup: Avoid synchronize_sched() in
    __cgroup_procs_write()") disabled percpu operations on threadgroup_rwsem
    because the impiled synchronize_rcu() on write locking was pushing up the
    latencies too much for android which constantly moves processes between
    cgroups.
    
    This makes the hotter paths - fork and exit - slower as they're always
    forced into the slow path. There is no reason to force this on everyone
    especially given that more common static usage pattern can now completely
    avoid write-locking the rwsem. Write-locking is elided when turning on and
    off controllers on empty sub-trees and CLONE_INTO_CGROUP enables seeding a
    cgroup without grabbing the rwsem.
    
    Restore the default percpu operations and introduce the mount option
    "favordynmods" and config option CGROUP_FAVOR_DYNMODS for users who need
    lower latencies for the dynamic operations.
    Signed-off-by: default avatarTejun Heo <tj@kernel.org>
    Cc: Christian Brauner <brauner@kernel.org>
    Cc: Michal Koutn� <mkoutny@suse.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: John Stultz <john.stultz@linaro.org>
    Cc: Dmitry Shmidt <dimitrysh@google.com>
    Cc: Oleg Nesterov <oleg@redhat.com>
    6a010a49
cgroup-v1.c 34.3 KB