* [PATCH] kernel/cgroup: cleanup cgroup_base_files when fail to add cgroup_psi_files
@ 2024-05-17 6:24 David Wang
2024-05-26 18:48 ` Tejun Heo
0 siblings, 1 reply; 2+ messages in thread
From: David Wang @ 2024-05-17 6:24 UTC (permalink / raw)
To: tj, lizefan.x, hannes; +Cc: cgroups, linux-kernel, David Wang
Even though css_clear_dir would be called to cleanup
all existing cgroup files when css_populate_dir failed,
reclaiming newly created cgroup files before
css_populate_dir returns with failure makes code more
consistent.
Signed-off-by: David Wang <00107082@163.com>
---
kernel/cgroup/cgroup.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
index a66c088c851c..6c255b5a331f 100644
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -1744,8 +1744,11 @@ static int css_populate_dir(struct cgroup_subsys_state *css)
if (cgroup_psi_enabled()) {
ret = cgroup_addrm_files(css, cgrp,
cgroup_psi_files, true);
- if (ret < 0)
+ if (ret < 0) {
+ cgroup_addrm_files(css, cgrp,
+ cgroup_base_files, false);
return ret;
+ }
}
} else {
ret = cgroup_addrm_files(css, cgrp,
--
2.39.2
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] kernel/cgroup: cleanup cgroup_base_files when fail to add cgroup_psi_files
2024-05-17 6:24 [PATCH] kernel/cgroup: cleanup cgroup_base_files when fail to add cgroup_psi_files David Wang
@ 2024-05-26 18:48 ` Tejun Heo
0 siblings, 0 replies; 2+ messages in thread
From: Tejun Heo @ 2024-05-26 18:48 UTC (permalink / raw)
To: David Wang; +Cc: lizefan.x, hannes, cgroups, linux-kernel
On Fri, May 17, 2024 at 02:24:05PM +0800, David Wang wrote:
> Even though css_clear_dir would be called to cleanup
> all existing cgroup files when css_populate_dir failed,
> reclaiming newly created cgroup files before
> css_populate_dir returns with failure makes code more
> consistent.
>
> Signed-off-by: David Wang <00107082@163.com>
Applied to cgroup/for-6.11.
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-05-26 18:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-17 6:24 [PATCH] kernel/cgroup: cleanup cgroup_base_files when fail to add cgroup_psi_files David Wang
2024-05-26 18:48 ` Tejun Heo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®