Re: [PATCH 1/8] mm: introduce for_each_process_rcu and for_each_thread_rcu
From: Steven Rostedt
Date: Tue Sep 08 2026 - 08:57:49 EST
On Sat, 05 Sep 2026 09:27:33 +0200
Thomas Gleixner <tglx@xxxxxxxxxx> wrote:
> Jump where ever you want. The keyword is 'scope'.
>
> The normal visibility rules of variables in C scopes apply. So if the
> scope for which a variable is defined is left and the variable is
> defined with __attribute__((__cleanup__(cleanup_func))) then the compiler
> inserts a call to 'cleanup_func()'.
I guess I was just confused by the comment in cleanup.h:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/linux/cleanup.h#n147
* Lastly, given that the benefit of cleanup helpers is removal of
* "goto", and that the "goto" statement can jump between scopes, the
* expectation is that usage of "goto" and cleanup helpers is never
* mixed in the same function. I.e. for a given routine, convert all
* resources that need a "goto" cleanup to scope-based cleanup, or
* convert none of them.
Hence, I was thinking that scoped guards had some issues with gotos.
Specifically the "goto statement can jump between scopes" I thought it was
more than just a guideline and that it could actually cause issues with the
compiled code.
-- Steve