Re: [PATCH] mm: fix address wraparound when scanning large folio PTEs
From: Lorenzo Stoakes (ARM)
Date: Wed Oct 14 2026 - 11:02:42 EST
On Wed, Oct 14, 2026 at 03:45:41PM +0200, David Hildenbrand (Arm) wrote:
> It's the following thing that adds confusion:
>
> include/asm-generic/pgtable-nopmd.h:#define pmd_addr_end(addr, end)
> (end)
Ah ugh :) of course.
> What I am saying is that I don't agree with adding another two const variables
> with names that are less intuitive than just saying the computation. Let me try
> to improve the comment:
>
> /* Avoid address wraparounds by not adding/subtracting beyond limits. */
The variables are a (possibly) neat way of self-documenting that, but then
possibly adds complexity by having yet another variable :)
A comment works for me, though the confusing bit I guess is knowing which bit
exactly might overflow.
So maybe saying 'avoid wraparounds of <variable that can wraparound>' and a
brief bit about how would help?
--
Cheers, Lorenzo