Thank you for your contribution! Sashiko AI review found 1 potential issue(s) 
to consider:
- [Low] Mixing goto-based cleanup labels with scope-based guard() declarations 
in the same function.
--

commit e4ac0b901a628fa09984a6972d98830031479b53
Author: Ye Liu <[email protected]>

kernel: convert process/thread iterators to for_each_*_rculock

This commit replaces manual rcu_read_lock() and rcu_read_unlock() pairs
combined with process/thread iterators across the kernel with the
for_each_*_rculock() macros. These macros use scoped_guard(rcu) to
handle the RCU lock duration.

> diff --git a/kernel/trace/fgraph.c b/kernel/trace/fgraph.c
> index 40d373d65f9b9..f797ce1192233 100644
> --- a/kernel/trace/fgraph.c
> +++ b/kernel/trace/fgraph.c
[ ... ]
> @@ -1057,11 +1057,10 @@ static int alloc_retstack_tasklist(unsigned long 
> **ret_stack_list)
>               }
>       }
>  
> -     rcu_read_lock();
> -     for_each_process_thread(g, t) {
> +     for_each_process_thread_rculock(g, t) {
>               if (start == end) {
>                       ret = -EAGAIN;
> -                     goto unlock;
> +                     goto free;

[Severity: Low]
Does jumping to a manual cleanup label from within the scoped_guard(rcu)
loop introduced by for_each_process_thread_rculock() violate the cleanup
subsystem guidelines?

According to include/linux/cleanup.h, goto and cleanup helpers should
never be mixed in the same function to avoid confusing ownership semantics.
Since alloc_retstack_tasklist() still uses a goto-based cleanup for
ret_stack_list, should the allocation here be converted to use scope-based
cleanup to avoid mixing these paradigms?

>               }
>  
>               if (t->ret_stack == NULL) {
> @@ -1074,9 +1073,6 @@ static int alloc_retstack_tasklist(unsigned long 
> **ret_stack_list)
>                       t->ret_stack = ret_stack_list[start++];
>               }
>       }
> -
> -unlock:
> -     rcu_read_unlock();
>  free:
>       for (i = start; i < end; i++)
>               kmem_cache_free(fgraph_stack_cachep, ret_stack_list[i]);

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=5

Reply via email to