]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
selftests/cgroup: Fix compile error in test_cpu.c
authorXiu Jianfeng <xiujianfeng@huawei.com>
Fri, 11 Oct 2024 06:11:53 +0000 (06:11 +0000)
committerTejun Heo <tj@kernel.org>
Tue, 15 Oct 2024 01:05:39 +0000 (15:05 -1000)
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>
Signed-off-by: Tejun Heo <tj@kernel.org>
tools/testing/selftests/cgroup/test_cpu.c

index 201ce14cb4227c92a37c99ce7fad634e2070263d..a2b50af8e9eeede0cf61d8394300cac02ccaf005 100644 (file)
@@ -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);