Thread (25 messages) 25 messages, 3 authors, 2025-05-14
STALE437d REVIEWED: 1 (0M)
Revisions (3)
  1. v1 current
  2. v4 [diff vs current]
  3. v5 [diff vs current]

[PATCH v1 5/5] relayfs: uniformally use possible cpu iteration

From: Jason Xing <hidden>
Date: 2025-05-12 02:49:57
Also in: linux-block, lkml
Subsystem: relay, the rest · Maintainers: Andrew Morton, Jens Axboe, Jason Xing, Linus Torvalds

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 <redacted>
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help