Re: [PATCH] mm/pagewalk: honor action in pgd_entry and p4d_entry

From: David Hildenbrand (Arm)

Date: Tue Apr 14 2026 - 04:07:29 EST


On 4/14/26 09:57, Vlastimil Babka (SUSE) wrote:
> On 4/14/26 07:18, Cao Ruichuang wrote:
>> walk_pud_range() and walk_pmd_range() reset walk->action to ACTION_SUBTREE and honor ACTION_CONTINUE/ACTION_AGAIN after invoking their callbacks, but walk_pgd_range() and walk_p4d_range() do not.
>>
>> That leaves the top levels with inconsistent callback semantics. In particular, ptdump sets ACTION_CONTINUE from pgd_entry() and p4d_entry() for leaf entries, but the generic walker still descends into lower levels instead of skipping the subtree.
>>
>> Initialize walk->action before calling pgd_entry() and p4d_entry(), and handle ACTION_CONTINUE and ACTION_AGAIN afterwards just like the lower page-table levels do. Also update the action comment to reflect that it applies to pgd_entry() and p4d_entry() as well.
>
> Your LLM has broken line wrapping. But it's ok, we're not interested in
> patches produced by LLM reviewing code, with no human oversight and
> understanding. NAK.

Agreed. The educated reader would know that we never end up with p4d/pgd
leaves in non-hugetlb VMAs.

The ptdump code is overly cautious ;)

--
Cheers,

David