From: Jason Xing <kerneljasonxing@gmail.com>
To: axboe@kernel.dk, rostedt@goodmis.org, mhiramat@kernel.org,
mathieu.desnoyers@efficios.com, akpm@linux-foundation.org
Cc: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org,
linux-trace-kernel@vger.kernel.org,
Jason Xing <kernelxing@tencent.com>,
Yushan Zhou <katrinzhou@tencent.com>
Subject: [PATCH v1 5/5] relayfs: uniformally use possible cpu iteration
Date: Mon, 12 May 2025 10:49:35 +0800 [thread overview]
Message-ID: <20250512024935.64704-6-kerneljasonxing@gmail.com> (raw)
In-Reply-To: <20250512024935.64704-1-kerneljasonxing@gmail.com>
From: Jason Xing <kernelxing@tencent.com>
Use for_each_possible_cpu to create per-cpu relayfs file to avoid later
hotplug cpu which doesn't have its own file.
Reviewed-by: Yushan Zhou <katrinzhou@tencent.com>
Signed-off-by: Jason Xing <kernelxing@tencent.com>
---
kernel/relay.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/relay.c b/kernel/relay.c
index 27f7e701724f..dcb099859e83 100644
--- a/kernel/relay.c
+++ b/kernel/relay.c
@@ -519,7 +519,7 @@ struct rchan *relay_open(const char *base_filename,
kref_init(&chan->kref);
mutex_lock(&relay_channels_mutex);
- for_each_online_cpu(i) {
+ for_each_possible_cpu(i) {
buf = relay_open_buf(chan, i);
if (!buf)
goto free_bufs;
@@ -615,7 +615,7 @@ int relay_late_setup_files(struct rchan *chan,
* no files associated. So it's safe to call relay_setup_buf_file()
* on all currently online CPUs.
*/
- for_each_online_cpu(i) {
+ for_each_possible_cpu(i) {
buf = *per_cpu_ptr(chan->buf, i);
if (unlikely(!buf)) {
WARN_ONCE(1, KERN_ERR "CPU has no buffer!\n");
--
2.43.5
next prev parent reply other threads:[~2025-05-12 2:49 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-12 2:49 [PATCH v1 0/5] relayfs: misc changes Jason Xing
2025-05-12 2:49 ` [PATCH v1 1/5] relayfs: support a counter tracking if per-cpu buffers is full Jason Xing
2025-05-13 0:51 ` Andrew Morton
2025-05-13 1:37 ` Jason Xing
2025-05-12 2:49 ` [PATCH v1 2/5] relayfs: introduce dump of relayfs statistics function Jason Xing
2025-05-13 0:51 ` Andrew Morton
2025-05-13 1:48 ` Jason Xing
2025-05-13 2:04 ` Andrew Morton
2025-05-13 2:26 ` Jason Xing
2025-05-13 3:41 ` Andrew Morton
2025-05-13 3:48 ` Jason Xing
2025-05-13 9:58 ` Masami Hiramatsu
2025-05-13 10:32 ` Jason Xing
2025-05-13 13:22 ` Masami Hiramatsu
2025-05-13 13:46 ` Jason Xing
2025-05-14 1:29 ` Masami Hiramatsu
2025-05-14 2:06 ` Jason Xing
2025-05-12 2:49 ` [PATCH v1 3/5] blktrace: use rbuf->stats.full as a drop indicator in relayfs Jason Xing
2025-05-12 2:49 ` [PATCH v1 4/5] relayfs: support a counter tracking if data is too big to write Jason Xing
2025-05-12 2:49 ` Jason Xing [this message]
2025-05-13 0:52 ` [PATCH v1 5/5] relayfs: uniformally use possible cpu iteration Andrew Morton
2025-05-13 2:03 ` Jason Xing
2025-05-13 3:21 ` Andrew Morton
2025-05-13 3:25 ` Jason Xing
2025-05-13 5:52 ` Jason Xing
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=20250512024935.64704-6-kerneljasonxing@gmail.com \
--to=kerneljasonxing@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=axboe@kernel.dk \
--cc=katrinzhou@tencent.com \
--cc=kernelxing@tencent.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
--cc=rostedt@goodmis.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;
as well as URLs for NNTP newsgroup(s).