linux-kselftest.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] selftests/cgroup: Fix compile error in test_cpu.c
@ 2024-10-11  6:11 Xiu Jianfeng
  2024-10-15  1:06 ` Tejun Heo
  0 siblings, 1 reply; 2+ messages in thread
From: Xiu Jianfeng @ 2024-10-11  6:11 UTC (permalink / raw)
  To: tj, lizefan.x, hannes, mkoutny, shuah, joshua.hahn6
  Cc: cgroups, linux-kselftest, linux-kernel, xiujianfeng

From: Xiu Jianfeng <xiujianfeng@huawei.com>

When compiling the cgroup selftests with the following command:

make -C tools/testing/selftests/cgroup/

the compiler complains as below:

test_cpu.c: In function ‘test_cpucg_nice’:
test_cpu.c:284:39: error: incompatible type for argument 2 of ‘hog_cpus_timed’
  284 |                 hog_cpus_timed(cpucg, param);
      |                                       ^~~~~
      |                                       |
      |                                       struct cpu_hog_func_param
test_cpu.c:132:53: note: expected ‘void *’ but argument is of type ‘struct cpu_hog_func_param’
  132 | static int hog_cpus_timed(const char *cgroup, void *arg)
      |                                               ~~~~~~^~~

Fix it by passing the address of param to hog_cpus_timed().

Fixes: 2e82c0d4562a ("cgroup/rstat: Selftests for niced CPU statistics")
Signed-off-by: Xiu Jianfeng <xiujianfeng@huawei.com>
---
 tools/testing/selftests/cgroup/test_cpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/cgroup/test_cpu.c b/tools/testing/selftests/cgroup/test_cpu.c
index 201ce14cb422..a2b50af8e9ee 100644
--- a/tools/testing/selftests/cgroup/test_cpu.c
+++ b/tools/testing/selftests/cgroup/test_cpu.c
@@ -281,7 +281,7 @@ static int test_cpucg_nice(const char *root)
 
 		/* Try to keep niced CPU usage as constrained to hog_cpu as possible */
 		nice(1);
-		hog_cpus_timed(cpucg, param);
+		hog_cpus_timed(cpucg, &param);
 		exit(0);
 	} else {
 		waitpid(pid, &status, 0);
-- 
2.34.1


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

end of thread, other threads:[~2024-10-15  1:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-11  6:11 [PATCH -next] selftests/cgroup: Fix compile error in test_cpu.c Xiu Jianfeng
2024-10-15  1:06 ` Tejun Heo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).