Linux Kernel Selftest development
 help / color / mirror / Atom feed
* [PATCH] selftests/cgroup: Fix cg_run_in_subcgroups ignoring arg parameter
@ 2026-08-20  7:09 Hongfu Li
  2026-08-20  9:27 ` Michal Koutný
  0 siblings, 1 reply; 2+ messages in thread
From: Hongfu Li @ 2026-08-20  7:09 UTC (permalink / raw)
  To: hannes, mhocko, roman.gushchin, shakeel.butt, muchun.song, tj,
	mkoutny, shuah, akpm
  Cc: cgroups, linux-mm, linux-kselftest, linux-kernel, hongfu.li,
	Hongfu Li

From: Hongfu Li <lihongfu@kylinos.cn>

cg_run_in_subcgroups() discards its arg and always passes NULL to cg_run(),
turning the (void *)100 from test_kmem_dead_cgroups() into NULL so no
allocation occurs.

This makes test_kmem_dead_cgroups() falsely pass without exercising the
"dying cgroup with charged slab" scenario it intends to test.

Pass the arg through to cg_run() to fix this.

Fixes: 933dc80ec262 ("kselftests: cgroup: add kernel memory accounting tests")
Signed-off-by: Hongfu Li <lihongfu@kylinos.cn>
---
 tools/testing/selftests/cgroup/test_kmem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/cgroup/test_kmem.c b/tools/testing/selftests/cgroup/test_kmem.c
index 1db0ba1226b9..98e9f9f45ab9 100644
--- a/tools/testing/selftests/cgroup/test_kmem.c
+++ b/tools/testing/selftests/cgroup/test_kmem.c
@@ -145,7 +145,7 @@ static int cg_run_in_subcgroups(const char *parent,
 			return -1;
 		}
 
-		if (cg_run(child, fn, NULL)) {
+		if (cg_run(child, fn, arg)) {
 			cg_destroy(child);
 			free(child);
 			return -1;
-- 
2.54.0


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

* Re: [PATCH] selftests/cgroup: Fix cg_run_in_subcgroups ignoring arg parameter
  2026-08-20  7:09 [PATCH] selftests/cgroup: Fix cg_run_in_subcgroups ignoring arg parameter Hongfu Li
@ 2026-08-20  9:27 ` Michal Koutný
  0 siblings, 0 replies; 2+ messages in thread
From: Michal Koutný @ 2026-08-20  9:27 UTC (permalink / raw)
  To: Hongfu Li
  Cc: hannes, mhocko, roman.gushchin, shakeel.butt, muchun.song, tj,
	shuah, akpm, cgroups, linux-mm, linux-kselftest, linux-kernel,
	Hongfu Li

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

On Thu, Aug 20, 2026 at 03:09:44PM +0800, Hongfu Li <hongfu.li@linux.dev> wrote:
> From: Hongfu Li <lihongfu@kylinos.cn>
> 
> cg_run_in_subcgroups() discards its arg and always passes NULL to cg_run(),
> turning the (void *)100 from test_kmem_dead_cgroups() into NULL so no
> allocation occurs.
> 
> This makes test_kmem_dead_cgroups() falsely pass without exercising the
> "dying cgroup with charged slab" scenario it intends to test.
> 
> Pass the arg through to cg_run() to fix this.
> 
> Fixes: 933dc80ec262 ("kselftests: cgroup: add kernel memory accounting tests")
> Signed-off-by: Hongfu Li <lihongfu@kylinos.cn>
> ---
>  tools/testing/selftests/cgroup/test_kmem.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Good catch,

Reviewed-by: Michal Koutný <mkoutny@suse.com>

[-- 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-08-20  9:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-20  7:09 [PATCH] selftests/cgroup: Fix cg_run_in_subcgroups ignoring arg parameter Hongfu Li
2026-08-20  9:27 ` Michal Koutný

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