Re: [PATCH 4/8] mm/memory-failure: convert process iterator to for_each_process_rcu
From: SJ Park
Date: Fri Sep 04 2026 - 20:39:19 EST
On Fri, 4 Sep 2026 16:29:56 +0800 Ye Liu <ye.liu@xxxxxxxxx> 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_rcu().
>
> No functional change.
>
> Signed-off-by: Ye Liu <liuye@xxxxxxxxxx>
> ---
> mm/memory-failure.c | 16 ++++------------
> 1 file changed, 4 insertions(+), 12 deletions(-)
>
> diff --git a/mm/memory-failure.c b/mm/memory-failure.c
> index a8b03e2920ba..63a2ff08ee33 100644
> --- a/mm/memory-failure.c
> +++ b/mm/memory-failure.c
> @@ -555,8 +555,7 @@ static void collect_procs_anon(const struct folio *folio,
> return;
>
> pgoff = page_pgoff(folio, page);
> - rcu_read_lock();
> - for_each_process(tsk) {
> + for_each_process_rcu(tsk) {
> struct vm_area_struct *vma;
> struct anon_vma_chain *vmac;
> struct task_struct *t = task_early_kill(tsk, force_early);
> @@ -572,7 +571,6 @@ static void collect_procs_anon(const struct folio *folio,
> add_to_kill_anon_file(t, page, vma, to_kill, addr);
> }
> }
> - rcu_read_unlock();
> anon_vma_unlock_read(av);
> }
>
> @@ -589,9 +587,8 @@ static void collect_procs_file(const struct folio *folio,
> pgoff_t pgoff;
>
> i_mmap_lock_read(mapping);
> - rcu_read_lock();
> pgoff = page_pgoff(folio, page);
> - for_each_process(tsk) {
> + for_each_process_rcu(tsk) {
> struct task_struct *t = task_early_kill(tsk, force_early);
> unsigned long addr;
This moves pgoff assignment out of the RCU critical section. Is this fine and
making no real functional change? If it is fine and no functiona change, could
we clarify the reasons on the commit message?
Thanks,
SJ
[...]