Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
* [PATCH] selftests/acct: Make the busy loop sink volatile
@ 2026-12-01 18:08 Sasha Levin
  0 siblings, 0 replies; only message in thread
From: Sasha Levin @ 2026-12-01 18:08 UTC (permalink / raw)
  To: Andrew Morton, Shuah Khan
  Cc: Sasha Levin, Yiyang Chen, Balbir Singh, linux-kselftest,
	linux-kernel, Nathan Chancellor, llvm

burn_cpu_for_ns() stores the result of its busy loop in busy_sink, which
nothing reads. clang 23 warns about that:

  taskstats_fill_stats_tgid.c:31:22: warning: variable 'busy_sink' set but not used [-Wunused-but-set-global]

Make busy_sink volatile, so that the store has to happen.

Fixes: 20e4b31f8e83 ("selftests/acct: add taskstats TGID retention test")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 tools/testing/selftests/acct/taskstats_fill_stats_tgid.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/acct/taskstats_fill_stats_tgid.c b/tools/testing/selftests/acct/taskstats_fill_stats_tgid.c
index 9a4c1554dee36..cd43b18c9a948 100644
--- a/tools/testing/selftests/acct/taskstats_fill_stats_tgid.c
+++ b/tools/testing/selftests/acct/taskstats_fill_stats_tgid.c
@@ -28,7 +28,7 @@ struct worker_ctx {
 	bool release;
 };
 
-static unsigned long busy_sink;
+static volatile unsigned long busy_sink;
 
 static uint64_t timespec_diff_ns(const struct timespec *start,
 				 const struct timespec *end)
-- 
2.53.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-12-01 18:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-01 18:08 [PATCH] selftests/acct: Make the busy loop sink volatile Sasha Levin

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