mirror of
https://github.com/rd-stuffs/msm-4.14.git
synced 2025-02-20 11:45:48 +08:00
BACKPORT: cgroup: Explicitly remove core interface files
The "cgroup." core interface files bypass the usual interface removal path and get removed recursively along with the cgroup itself. While this works now, the subtle discrepancy gets in the way of implementing common mechanisms. This patch updates cgroup core interface file handling so that it's consistent with controller interface files. When added, the css is marked CSS_VISIBLE and they're explicitly removed before the cgroup is destroyed. This doesn't cause user-visible behavior changes. Signed-off-by: Tejun Heo <tj@kernel.org> Change-Id: I4091581388cb1514171d6de8fdac5f0fe6ae1695 (cherry picked from commit 5faaf05f2976fd9ec0ecd582bcfb3a41cde4c65e) Bug: 154548692 Signed-off-by: Marco Ballesio <balejs@google.com> (cherry picked from commit 1c95325d9b62e843a2bfca3a8a3b5d7b11deebb1) Signed-off-by: Panchajanya1999 <panchajanya@azure-dev.live> Signed-off-by: Adithya R <gh0strider.2k18.reborn@gmail.com>
This commit is contained in:
parent
ea1587274f
commit
0aea305780
@ -1555,9 +1555,18 @@ static void css_clear_dir(struct cgroup_subsys_state *css)
|
||||
|
||||
css->flags &= ~CSS_VISIBLE;
|
||||
|
||||
if (!css->ss) {
|
||||
if (cgroup_on_dfl(cgrp))
|
||||
cfts = cgroup_base_files;
|
||||
else
|
||||
cfts = cgroup1_base_files;
|
||||
|
||||
cgroup_addrm_files(css, cgrp, cfts, false);
|
||||
} else {
|
||||
list_for_each_entry(cfts, &css->ss->cfts, node)
|
||||
cgroup_addrm_files(css, cgrp, cfts, false);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* css_populate_dir - create subsys files in a cgroup directory
|
||||
@ -1580,9 +1589,10 @@ static int css_populate_dir(struct cgroup_subsys_state *css)
|
||||
else
|
||||
cfts = cgroup1_base_files;
|
||||
|
||||
return cgroup_addrm_files(&cgrp->self, cgrp, cfts, true);
|
||||
}
|
||||
|
||||
ret = cgroup_addrm_files(&cgrp->self, cgrp, cfts, true);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
} else {
|
||||
list_for_each_entry(cfts, &css->ss->cfts, node) {
|
||||
ret = cgroup_addrm_files(css, cgrp, cfts, true);
|
||||
if (ret < 0) {
|
||||
@ -1590,6 +1600,7 @@ static int css_populate_dir(struct cgroup_subsys_state *css)
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
css->flags |= CSS_VISIBLE;
|
||||
|
||||
@ -5215,10 +5226,8 @@ static int cgroup_destroy_locked(struct cgroup *cgrp)
|
||||
for_each_css(css, ssid, cgrp)
|
||||
kill_css(css);
|
||||
|
||||
/*
|
||||
* Remove @cgrp directory along with the base files. @cgrp has an
|
||||
* extra ref on its kn.
|
||||
*/
|
||||
/* clear and remove @cgrp dir, @cgrp has an extra ref on its kn */
|
||||
css_clear_dir(&cgrp->self);
|
||||
kernfs_remove(cgrp->kn);
|
||||
|
||||
if (parent && cgroup_is_threaded(cgrp))
|
||||
|
Loading…
x
Reference in New Issue
Block a user