Re: [PATCH v2 4/8] mm/memory-failure: convert process iterator to for_each_process_rculock

From: Gregory Price

Date: Mon Sep 07 2026 - 11:55:41 EST


On Mon, Sep 07, 2026 at 04:13:30PM +0800, Ye Liu wrote:
> From: Ye Liu <liuye@xxxxxxxxxx>
>
> Replace the manual rcu_read_lock()/rcu_read_unlock() pairs combined
> with for_each_process() loop in mm/memory-failure.c with
> for_each_process_rculock(), which scopes the RCU read lock to the
> loop body via scoped_guard(rcu).
>
> In collect_procs_file(), the page_pgoff() call now falls outside the
> RCU read-side critical section. This is safe because page_pgoff()
> only reads folio->index and does not traverse any RCU-protected
> structures.
>
> Signed-off-by: Ye Liu <liuye@xxxxxxxxxx>
> Acked-by: Michal Hocko <mhocko@xxxxxxxx>
> Acked-by: Miaohe Lin <linmiaohe@xxxxxxxxxx>

Reviewed-by: Gregory Price (Meta) <gourry@xxxxxxxxxx>