]> www.infradead.org Git - users/jedix/linux-maple.git/commit
cgroup: make sure a parent css isn't offlined before its children
authorTejun Heo <tj@kernel.org>
Thu, 21 Jan 2016 20:31:11 +0000 (15:31 -0500)
committerShan Hai <shan.hai@oracle.com>
Thu, 7 Dec 2017 05:58:02 +0000 (13:58 +0800)
commitd49dcb423a8b22ad619ed33240c46b261ad4a9e5
tree47312a56c8ea77ef1e906551904490aad6b78297
parente92e37e7b3855abdee9f1f47d3ae2ff2afecf31f
cgroup: make sure a parent css isn't offlined before its children

There are three subsystem callbacks in css shutdown path -
css_offline(), css_released() and css_free().  Except for
css_released(), cgroup core didn't guarantee the order of invocation.
css_offline() or css_free() could be called on a parent css before its
children.  This behavior is unexpected and led to bugs in cpu and
memory controller.

This patch updates offline path so that a parent css is never offlined
before its children.  Each css keeps online_cnt which reaches zero iff
itself and all its children are offline and offline_css() is invoked
only after online_cnt reaches zero.

This fixes the memory controller bug and allows the fix for cpu
controller.

Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-and-tested-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reported-by: Brian Christiansen <brian.o.christiansen@gmail.com>
Link: http://lkml.kernel.org/g/5698A023.9070703@de.ibm.com
Link: http://lkml.kernel.org/g/CAKB58ikDkzc8REt31WBkD99+hxNzjK4+FBmhkgS+NVrC9vjMSg@mail.gmail.com
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: stable@vger.kernel.org
Orabug: 27045648

(backport upstream commit aa226ff4a1ce79f229c6b7a4c0a14e17fececd01)

Conflict:
include/linux/cgroup-defs.h

Fix a kABI breakage

Signed-off-by: Shan Hai <shan.hai@oracle.com>
Reviewed-by: Dhaval Giani <dhaval.giani@oracle.com>
include/linux/cgroup.h
kernel/cgroup.c