Linux cgroups development
 help / color / mirror / Atom feed
* [PATCH] cgroup: Avoid warning when procfs is disabled
@ 2026-10-12  5:42 Karl Mehltretter
  2026-10-12 12:37 ` Michal Koutný
  0 siblings, 1 reply; 2+ messages in thread
From: Karl Mehltretter @ 2026-10-12  5:42 UTC (permalink / raw)
  To: Tejun Heo, Johannes Weiner, Michal Koutný
  Cc: Karl Mehltretter, Li Zefan, cgroups, linux-kernel

With CGROUPS=y and PROC_FS=n, proc_create_single() returns NULL and
cgroup initialization warns during every boot.

Only check creation of /proc/cgroups when procfs is enabled.

Fixes: 035f4f510583 ("cgroup: replace error handling in cgroup_init() with WARN_ON()s")
Assisted-by: LLM
Signed-off-by: Karl Mehltretter <kmehltretter@gmail.com>
---
 kernel/cgroup/cgroup.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
index 227d09704ca5..567afb75a4ec 100644
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -6612,7 +6612,9 @@ int __init cgroup_init(void)
 	WARN_ON(sysfs_create_mount_point(fs_kobj, "cgroup"));
 	WARN_ON(register_filesystem(&cgroup_fs_type));
 	WARN_ON(register_filesystem(&cgroup2_fs_type));
-	WARN_ON(!proc_create_single("cgroups", 0, NULL, proc_cgroupstats_show));
+	if (IS_ENABLED(CONFIG_PROC_FS))
+		WARN_ON(!proc_create_single("cgroups", 0, NULL,
+					    proc_cgroupstats_show));
 #ifdef CONFIG_CPUSETS_V1
 	WARN_ON(register_filesystem(&cpuset_fs_type));
 #endif
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] cgroup: Avoid warning when procfs is disabled
  2026-10-12  5:42 [PATCH] cgroup: Avoid warning when procfs is disabled Karl Mehltretter
@ 2026-10-12 12:37 ` Michal Koutný
  0 siblings, 0 replies; 2+ messages in thread
From: Michal Koutný @ 2026-10-12 12:37 UTC (permalink / raw)
  To: Karl Mehltretter
  Cc: Tejun Heo, Johannes Weiner, Li Zefan, cgroups, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 596 bytes --]

On Mon, Oct 12, 2026 at 07:42:19AM +0200, Karl Mehltretter <kmehltretter@gmail.com> wrote:
> With CGROUPS=y and PROC_FS=n,

What is practical about this config? Is it real life usage?

> proc_create_single() returns NULL and
> cgroup initialization warns during every boot.
> 
> Only check creation of /proc/cgroups when procfs is enabled.

The dependency on CONFIG_PROC_FS is encoded in the
proc_create_single already, it's unfortunate that it returns a value
that signifies an error.
I'd prefer more generic fix that doesn't target cgroup_init()
specifically.

Thanks,
Michal

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 265 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-10-12 12:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-12  5:42 [PATCH] cgroup: Avoid warning when procfs is disabled Karl Mehltretter
2026-10-12 12:37 ` Michal Koutný

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox