Re: [PATCH v2 2/3] mm: khugepaged: fix folio is used after pte_unmap_unlock()
From: Lorenzo Stoakes (ARM)
Date: Mon Aug 17 2026 - 12:36:39 EST
On Mon, Aug 17, 2026 at 06:20:02PM +0200, David Hildenbrand (Arm) wrote:
> On 8/17/26 18:11, Lorenzo Stoakes (ARM) wrote:
> > Same comment as 1/3 I don't see why we should be storing a pfn value used
> > nowhere else just for tracing.
>
> I prefer it that way. Even if just for tracing. :)
This is moot because you have to store the PFN for lifetime for museum-piece
architectures.
But anyway FWIW:
Yes I agree accessing a now-invalid folio isn't great, but the reason I dislike
this pattern is that you're tracking this state in a different way that now has
maintenance overhead (if anybody reassigns folio or does weird control flow
etc. they must now update 2 things and etc.)
For the sake of CONFIG_SPARSEMEM and tracing for a value that is not at all
intuitive as to what it means, that's not great.
Let me go back and review this again accounting for the lifetime issue that I
missed first time.
>
> --
> Cheers,
>
> David
--
Cheers, Lorenzo