Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1400847

[RFC PATCH] cgroup: remove redundant cleanup in css_create

From Wenwei Tao <wwtao0320@163.com>
Newsgroups linux.kernel
Subject [RFC PATCH] cgroup: remove redundant cleanup in css_create
Date 2016-05-13 17:10 +0200
Message-ID <rymSZ-62Q-11@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


From: Wenwei Tao <ww.tao0320@gmail.com>

When create css failed, before call css_free_rcu_fn,
we remove the css id and exit the percpu_ref, but we
will do these again in css_free_work_fn, so they are redundant.
Especially the css id, that would cause problem if we
remove it twice, since it may be assigned to another
css after the first remove.

Signed-off-by: Wenwei Tao <ww.tao0320@gmail.com>
---
 kernel/cgroup.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 909a7d3..9df3a29 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -5088,7 +5088,7 @@ static struct cgroup_subsys_state *css_create(struct cgroup *cgrp,
 
 	err = cgroup_idr_alloc(&ss->css_idr, NULL, 2, 0, GFP_KERNEL);
 	if (err < 0)
-		goto err_free_percpu_ref;
+		goto err_free_css;
 	css->id = err;
 
 	/* @css is ready to be brought online now, make it visible */
@@ -5112,9 +5112,6 @@ static struct cgroup_subsys_state *css_create(struct cgroup *cgrp,
 
 err_list_del:
 	list_del_rcu(&css->sibling);
-	cgroup_idr_remove(&ss->css_idr, css->id);
-err_free_percpu_ref:
-	percpu_ref_exit(&css->refcnt);
 err_free_css:
 	call_rcu(&css->rcu_head, css_free_rcu_fn);
 	return ERR_PTR(err);
-- 
1.8.3.1

Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

[RFC PATCH] cgroup: remove redundant cleanup in css_create Wenwei Tao <wwtao0320@163.com> - 2016-05-13 17:10 +0200
  [PATCH] cgroup: remove redundant cleanup in css_create Tejun Heo <tj@kernel.org> - 2016-05-26 21:20 +0200
    [PATCH cgroup/for-4.7-fixes] cgroup: set css->id to -1 during init Tejun Heo <tj@kernel.org> - 2016-05-26 21:50 +0200

csiph-web