Thread (47 messages) flat view 47 messages, 9 authors, 4h ago

Re: [PATCH v2 5/8] kernel: convert process/thread iterators to for_each_*_rculock

From: Oleg Nesterov <oleg@redhat.com>
Date: 2026-09-07 21:55:04
Also in: linux-fsdevel, linux-mm, linux-pm, linux-trace-kernel, lkml, rcu

On 09/07, Gregory Price wrote:
On Mon, Sep 07, 2026 at 07:57:15PM +0200, Oleg Nesterov wrote:
quoted
On 09/07, Gregory Price wrote:
quoted
On Mon, Sep 07, 2026 at 04:13:31PM +0800, Ye Liu wrote:
quoted
--- a/kernel/hung_task.c
+++ b/kernel/hung_task.c
@@ -315,13 +315,12 @@ static void check_hung_uninterruptible_tasks(unsigned long timeout)
 		return;

 	this_round_count = 0;
-	rcu_read_lock();
-	for_each_process_thread(g, t) {
+	for_each_process_thread_rculock(g, t) {
 		if (!max_count--)
-			goto unlock;
+			goto out;
... snip ...
quoted
- unlock:
-	rcu_read_unlock();
-
+out:
 	if (!this_round_count)
 		return;
The sunken rcu_read_lock()/unlock() + scoped_guard usage makes this goto
at a minimum very confusing, if not actually broken.
I am afraid I misunderstood you concerns...
This might be my - admittedly shallow - understanding of scoped_guard,
but does scoped guard handle goto correctly?
Yes, it does,
and why it's generally discouraged to mix cleanup.h and goto.
Hmm, why? I didn't know...

Oleg.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help