On 03.07.23 15:24, Zi Yan wrote:
On 2 Jul 2023, at 21:09, Yin, Fengwei wrote:
On 7/3/2023 3:51 AM, Zi Yan wrote:
(3) Mapcount of first (or any other) subpage (compount+subpage): for
folio_estimated_sharers().
This is another estimation. I wonder if we can use a different estimation
like total_mapcount() > folio_nr_pages() instead.
Considering the partial folio mapping, I suppose we should use
total_mapcount() > folio->_nr_pages_mapped
as folio_estimated_sharers().
What you propose is to get a precise check instead of estimate, and you assume no PMD mapping and still require per-page mapcount.
What I am proposing is to get rid of per-page mapcount, which is my goal, and use a single mapcount to do a rough estimate.
... and I am (a) not sure it's desirable to only have a single mapcount
just for the sake of it (b) for something that's PMD mappable (IOW, 2
MiB THP), the overhead of having 1 vs. 2 vs. 3. mapcount is pretty
insignificant. 512 vs. 3 is still a big win.
... but again, I have to finish my homework first to make sure I haven't
missed any corner cases.
--
Cheers,
David / dhildenb