Re: [PATCH] change next_thread() to use list_next_entry_circular()

From: Oleg Nesterov

Date: Sat Dec 05 2026 - 13:17:32 EST


On 12/05, Chris Mason wrote:
>
> On Sat, Dec 5, 2026, at 10:59 AM, Oleg Nesterov wrote:
> > TODO: we actually need an list_next_entry_circular_rcu() which we
> > don't have yet.
>
> It looks like we don't need it if check_unsafe_exec() uses for_each_thread(),
> like in patch 2 of my series. With your change, everything else that calls
> next_thread() holds siglock or tasklist_lock.

Yes (although I need to recheck just in case).

But OTOH, if we add a simpler _rcu variant we don't need to change
check_unsafe_exec() ;)

And in general this makes more sense to me, this way
for_other_threads/next_thread/while_each_thread can have other
rcu-protected users.

Oleg.