Re: [v2 03/16] fs/proc: use softleaf_has_pfn() in pagemap PMD walker
From: Zi Yan
Date: Sat Jun 13 2026 - 15:01:35 EST
On 2 Jun 2026, at 10:24, Usama Arif wrote:
> pagemap_pmd_range_thp() assumes that every non-present PMD is a
> migration entry and unconditionally calls softleaf_to_page(). This
> will crash on any non-present PMD type that does not encode a PFN,
> such as the upcoming PMD-level swap entries.
>
> Guard the page lookup with softleaf_has_pfn(), matching how
> pte_to_pagemap_entry() already handles non-present PTEs.
>
> Acked-by: David Hildenbrand (Arm) <david@xxxxxxxxxx>
> Signed-off-by: Usama Arif <usama.arif@xxxxxxxxx>
> ---
> fs/proc/task_mmu.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
LGTM. I wonder if we want to change softleaf_to_page() and
softleaf_to_page() to return NULL if softleaf_has_pfn()
returns false. That might reduce such errors.
Reviewed-by: Zi Yan <ziy@xxxxxxxxxx>
--
Best Regards,
Yan, Zi