[PATCH 7/8] lib: convert process iterator to for_each_process_rcu
From: Ye Liu
Date: Fri Sep 04 2026 - 04:37:10 EST
From: Ye Liu <liuye@xxxxxxxxxx>
Replace the manual rcu_read_lock()/rcu_read_unlock() pair combined
with for_each_process() loop in lib/ with for_each_process_rcu().
No functional change.
Signed-off-by: Ye Liu <liuye@xxxxxxxxxx>
---
lib/is_single_threaded.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/lib/is_single_threaded.c b/lib/is_single_threaded.c
index 8c98b20bfc41..0682dc87bcdf 100644
--- a/lib/is_single_threaded.c
+++ b/lib/is_single_threaded.c
@@ -26,8 +26,7 @@ bool current_is_single_threaded(void)
return true;
ret = false;
- rcu_read_lock();
- for_each_process(p) {
+ for_each_process_rcu(p) {
if (unlikely(p->flags & PF_KTHREAD))
continue;
if (unlikely(p == task->group_leader))
@@ -48,7 +47,5 @@ bool current_is_single_threaded(void)
}
ret = true;
found:
- rcu_read_unlock();
-
return ret;
}
--
2.25.1