Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1315084
| From | Tejun Heo <tj@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v2 2/2] cgroup: make sure a parent css isn't freed before its children |
| Date | 2016-01-22 16:50 +0100 |
| Message-ID | <qTM8j-5YV-23@gated-at.bofh.it> (permalink) |
| References | <qQOgi-6eV-7@gated-at.bofh.it> <qQWdP-3jT-7@gated-at.bofh.it> <qR79g-2OU-11@gated-at.bofh.it> <qTubq-1Zs-35@gated-at.bofh.it> <qTubq-1Zs-33@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From 8bb5ef79bc0f4016ecf79e8dce6096a3c63603e4 Mon Sep 17 00:00:00 2001
From: Tejun Heo <tj@kernel.org>
Date: Thu, 21 Jan 2016 15:32:15 -0500
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.
The previous patch updated ordering for css_offline() which fixes the
cpu controller issue. While there currently isn't a known bug caused
by misordering of css_free() invocations, let's fix it too for
consistency.
css_free() ordering can be trivially fixed by moving putting of the
parent css below css_free() invocation.
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
---
Hello,
Applied to cgroup/for-4.5-fixes w/ description updated. Will push out
to Linus early next week.
Thanks.
kernel/cgroup.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index d015877..d27904c 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -4657,14 +4657,15 @@ static void css_free_work_fn(struct work_struct *work)
if (ss) {
/* css free path */
+ struct cgroup_subsys_state *parent = css->parent;
int id = css->id;
- if (css->parent)
- css_put(css->parent);
-
ss->css_free(css);
cgroup_idr_remove(&ss->css_idr, id);
cgroup_put(cgrp);
+
+ if (parent)
+ css_put(parent);
} else {
/* cgroup free path */
atomic_dec(&cgrp->root->nr_cgrps);
--
2.5.0
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 1/2] cgroup: make sure a parent css isn't offlined before its children Tejun Heo <tj@kernel.org> - 2016-01-21 21:40 +0100
[PATCH 2/2] cgroup: make sure a parent css isn't freed before its children Tejun Heo <tj@kernel.org> - 2016-01-21 21:40 +0100
[PATCH v2 2/2] cgroup: make sure a parent css isn't freed before its children Tejun Heo <tj@kernel.org> - 2016-01-22 16:50 +0100
Re: [PATCH 1/2] cgroup: make sure a parent css isn't offlined before its children Tejun Heo <tj@kernel.org> - 2016-01-21 22:30 +0100
Re: [PATCH 1/2] cgroup: make sure a parent css isn't offlined before its children Christian Borntraeger <borntraeger@de.ibm.com> - 2016-01-22 09:20 +0100
Re: [PATCH 1/2] cgroup: make sure a parent css isn't offlined before its children Peter Zijlstra <peterz@infradead.org> - 2016-01-21 22:30 +0100
[PATCH v2 1/2] cgroup: make sure a parent css isn't offlined before its children Tejun Heo <tj@kernel.org> - 2016-01-22 16:50 +0100
csiph-web