Re: [PATCH 2/3] mm: Add generic helper to hint a large folio

From: David Hildenbrand
Date: Fri May 09 2025 - 05:20:07 EST


On 09.05.25 07:25, Dev Jain wrote:


On 08/05/25 4:25 pm, David Hildenbrand wrote:

(2) Do we really need "must be part of the same folio", or could be just
batch over present
ptes that map consecutive PFNs? In that case, a helper that avoids
folio_pte_batch() completely
might be better.

I am not sure I get you here. folio_pte_batch() seems to be the simplest
thing we can do as being done around in the code elsewhere, I am not
aware of any alternate.

If we don't need the folio, then we can have a batching function that
doesn't require the folio.

Likely, we could even factor that (non-folio batching) out from
folio_pte_batch().
The recent fix [1] might make that easier. See below.


So my question is: is something relying on all of these PTEs to point at
the same folio?

Hmm...get_and_clear_full_ptes, as you say in another mail, will require
that...


[1] https://lkml.kernel.org/r/20250502215019.822-2-arkamar@xxxxxxxx


Something like this: (would need kerneldoc, probably remove "addr"
parameter from folio_pte_batch(),
and look into other related cleanups as discussed with Andrew)

I like this refactoring! Can you tell the commit hash on which you make
the patch, I cannot apply it.

Oh, it was just on top of my private version of [1]. It should now be in mm-new (or mm-unstable, did not check).

But as raised in my other mail, get_and_clear_full_ptes() might be problematic across folios.


--
Cheers,

David / dhildenb