Linux Kernel Selftest development
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: Andrew Morton <akpm@linux-foundation.org>, Shuah Khan <shuah@kernel.org>
Cc: Sasha Levin <sashal@kernel.org>,
	Yiyang Chen <cyyzero16@gmail.com>,
	Balbir Singh <balbirs@nvidia.com>,
	linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
	Nathan Chancellor <nathan@kernel.org>,
	llvm@lists.linux.dev
Subject: [PATCH] selftests/acct: Make the busy loop sink volatile
Date: Tue,  1 Dec 2026 13:08:50 -0500	[thread overview]
Message-ID: <20261201180855.740952-2-sashal@kernel.org> (raw)

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


                 reply	other threads:[~2026-12-01 18:09 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261201180855.740952-2-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=balbirs@nvidia.com \
    --cc=cyyzero16@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=nathan@kernel.org \
    --cc=shuah@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox