Re: [PATCH v3 20/20] mm: stop maintaining the per-page mapcount of large folios (CONFIG_NO_PAGE_MAPCOUNT)
From: Wei Yang
Date: Tue Oct 14 2025 - 08:23:38 EST
On Mon, Mar 03, 2025 at 05:30:13PM +0100, David Hildenbrand wrote:
[...]
>@@ -1678,6 +1726,22 @@ static __always_inline void __folio_remove_rmap(struct folio *folio,
> break;
> case RMAP_LEVEL_PMD:
> case RMAP_LEVEL_PUD:
>+ if (IS_ENABLED(CONFIG_NO_PAGE_MAPCOUNT)) {
>+ last = atomic_add_negative(-1, &folio->_entire_mapcount);
>+ if (level == RMAP_LEVEL_PMD && last)
>+ nr_pmdmapped = folio_large_nr_pages(folio);
>+ nr = folio_dec_return_large_mapcount(folio, vma);
>+ if (!nr) {
>+ /* Now completely unmapped. */
>+ nr = folio_large_nr_pages(folio);
>+ } else {
>+ partially_mapped = last &&
>+ nr < folio_large_nr_pages(folio);
Hi, David
Do you think this is better to be?
partially_mapped = last && nr < nr_pmdmapped;
As commit 349994cf61e6 mentioned, we don't support partially mapped PUD-sized
folio yet.
Not sure what I missed here.
>+ nr = 0;
>+ }
>+ break;
>+ }
>+
> folio_dec_large_mapcount(folio, vma);
> last = atomic_add_negative(-1, &folio->_entire_mapcount);
> if (last) {
>--
>2.48.1
>
--
Wei Yang
Help you, Help me