On Sun, Jul 02, 2023 at 01:45:48PM +0200, David Hildenbrand wrote: > Further, for (1) we'd want a 64bit mapcount for large folios, which implies > a 64bit refcount. For smallish folios, we don't really care. > > > We should most probably use a bi-weekly MM meeting to discuss that. We have a bi-weekly meeting to discuss all these things; it's the same time/day as the MM meeting, but the other weeks in-between. Last one, we discussed the idea of having a 64-bit mapcount stored in a tail page, but having mapcount only contribute 1 to refcount instead of refcount being incremented for every mapcount. We do this trick with mm_users and mm_count (for different reasons, but it's not unprecedented). eg we could do this as: page_add_anon_rmap: if (folio_test_large(folio)) first = atomic64_inc_and_test(&folio->_mapcount64) else first = atomic_inc_and_test(&page->_mapcount); if (!first) folio_put(folio); which is substantially simpler than what's there now. The accounting needs a bit of extra work.