On Thu, Aug 28, 2025 at 11:56:00AM -0700, Dave Hansen wrote:
I got a bit sick of sending constant emails on this one and just decided to hack it together myself. Here's roughly what I came up with. Completely untested. Changelogs are bare. Barely compiles:
https://git.kernel.org/pub/scm/linux/kernel/git/daveh/devel.git/log/?h=kpte
I also didn't actually hook up the IOMMU flush yet.
The biggest single chunk of code is defining ptdesc_*_kernel(). The rest of it is painfully simple.
Seems not great to be casting ptdesc to folio just to use folio_set_referenced(), I'm pretty sure that is no the direction things are going in..
I'd set the flag yourself or perhaps use the memory of __page_mapping to store a flag (but zero it before freeing).
Looks OK otherwise
Jason