From: Khaled Saleh <khaled.saleh.req@gmail.com>
To: Chris Li <sparse@chrisli.org>
Cc: linux-sparse@vger.kernel.org, linux-kernel@vger.kernel.org,
khaled.saleh.req@gmail.com
Subject: [PATCH] tracing: make ftrace_branch_data counters atomic
Date: Tue, 5 May 2026 15:25:40 +0200 [thread overview]
Message-ID: <20260505132540.414617-1-khaled.saleh.req@gmail.com> (raw)
Replace unsigned long counters with local_t and update all
increments and reads to use local_inc() and local_read().
This fixes potential race conditions in branch statistics
updates across CPUs.
Signed-off-by: Khaled Saleh <khaled.saleh.req@gmail.com>
---
include/linux/compiler.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 1a506c54c060..39b89544adc7 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -66,8 +66,8 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val,
.line = __LINE__, \
}; \
(cond) ? \
- (local_inc(&__if_trace.miss_hit[1]),1) :\
- (local_inc(&__if_trace.miss_hit[0]),0); \
+ (local_inc(&__if_trace.miss_hit[1]), 1) :\
+ (local_inc(&__if_trace.miss_hit[0]), 0); \
})
#endif /* CONFIG_PROFILE_ALL_BRANCHES */
--
2.34.1
reply other threads:[~2026-05-05 13:26 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=20260505132540.414617-1-khaled.saleh.req@gmail.com \
--to=khaled.saleh.req@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sparse@vger.kernel.org \
--cc=sparse@chrisli.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