On 04.12.23 18:17, Matthew Wilcox wrote:
On Mon, Dec 04, 2023 at 04:09:36PM +0100, David Hildenbrand wrote:
I think for the pagecache it should work. In the context of [1], a total
mapcount would likely still be possible. Anything beyond that likely not, if
we ever care.
I confess I hadn't gone through your patches.
https://lore.kernel.org/all/20231124132626.235350-8-david@xxxxxxxxxx/
is the critical one. It's actually going to walk off the end of order-2
folios today (which we'll create, eg with XFS).
Note that order-2 only uses _rmap_val0. So that *should* work as
expected (and that layout resulted in the best cache behavior, weirdly
enough).
You can put _rmap_val0 and _rmap_val1 in page2 and _rmap_val2-5 in page3
to fix this. Once we're allocating order-1 folios, I think you can
avoid this scheme and just check page0 and page1 mapcounts independently.
I could put _rmap_val0 in page1 after I get rid of _folio_nr_pages.
That would make it work on 64bit.
But yeah, it feels kind of stupid to do elaborate tracking for "it's 2
pages". OTOH, less special-casing can be preferable.
--
Cheers,
David / dhildenb