Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 86a3db56 authored by Li Zefan's avatar Li Zefan Committed by Tejun Heo
Browse files

cgroup: remove duplicate RCU free on struct cgroup



When destroying a cgroup, though in cgroup_diput() we've called
synchronize_rcu(), we then still have to free it via call_rcu().

The story is, long ago to fix a race between reading /proc/sched_debug
and freeing cgroup, the code was changed to utilize call_rcu(). See
commit a47295e6 ("cgroups: make
cgroup_path() RCU-safe")

As we've fixed cpu cgroup that cpu_cgroup_offline_css() is used
to unregister a task_group so there won't be concurrent access
to this task_group after synchronize_rcu() in diput(). Now we can
just kfree(cgrp).

Signed-off-by: default avatarLi Zefan <lizefan@huawei.com>
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
parent 2a73991b
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -892,7 +892,7 @@ static void cgroup_diput(struct dentry *dentry, struct inode *inode)
		simple_xattrs_free(&cgrp->xattrs);
		simple_xattrs_free(&cgrp->xattrs);


		ida_simple_remove(&cgrp->root->cgroup_ida, cgrp->id);
		ida_simple_remove(&cgrp->root->cgroup_ida, cgrp->id);
		kfree_rcu(cgrp, rcu_head);
		kfree(cgrp);
	} else {
	} else {
		struct cfent *cfe = __d_cfe(dentry);
		struct cfent *cfe = __d_cfe(dentry);
		struct cgroup *cgrp = dentry->d_parent->d_fsdata;
		struct cgroup *cgrp = dentry->d_parent->d_fsdata;