* + mm-thp-clearpagedoublemap-in-first-page_add_file_rmap.patch added to -mm tree
@ 2022-03-04 3:55 Andrew Morton
0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2022-03-04 3:55 UTC (permalink / raw)
To: mm-commits, shy828301, kirill.shutemov, hughd, akpm
The patch titled
Subject: mm/thp: ClearPageDoubleMap in first page_add_file_rmap()
has been added to the -mm tree. Its filename is
mm-thp-clearpagedoublemap-in-first-page_add_file_rmap.patch
This patch should soon appear at
https://ozlabs.org/~akpm/mmots/broken-out/mm-thp-clearpagedoublemap-in-first-page_add_file_rmap.patch
and later at
https://ozlabs.org/~akpm/mmotm/broken-out/mm-thp-clearpagedoublemap-in-first-page_add_file_rmap.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated
there every 3-4 working days
------------------------------------------------------
From: Hugh Dickins <hughd@google.com>
Subject: mm/thp: ClearPageDoubleMap in first page_add_file_rmap()
PageDoubleMap is maintained differently for anon and for shmem+file: the
shmem+file one was never cleared, because a safe place to do so could not
be found; so it would blight future use of the cached hugepage until
evicted.
See https://lore.kernel.org/lkml/1571938066-29031-1-git-send-email-yang.shi@linux.alibaba.com/
But page_add_file_rmap() does provide a safe place to do so (though later
than one might wish): allowing testing to return to an initial state
without a damaging drop_caches.
Link: https://lkml.kernel.org/r/61c5cf99-a962-9a25-597a-53ab1bd8fbc0@google.com
Fixes: 9a73f61bdb8a ("thp, mlock: do not mlock PTE-mapped file huge pages")
Signed-off-by: Hugh Dickins <hughd@google.com>
Reviewed-by: Yang Shi <shy828301@gmail.com>
Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
mm/rmap.c | 11 +++++++++++
1 file changed, 11 insertions(+)
--- a/mm/rmap.c~mm-thp-clearpagedoublemap-in-first-page_add_file_rmap
+++ a/mm/rmap.c
@@ -1252,6 +1252,17 @@ void page_add_file_rmap(struct page *pag
}
if (!atomic_inc_and_test(compound_mapcount_ptr(page)))
goto out;
+
+ /*
+ * It is racy to ClearPageDoubleMap in page_remove_file_rmap();
+ * but page lock is held by all page_add_file_rmap() compound
+ * callers, and SetPageDoubleMap below warns if !PageLocked:
+ * so here is a place that DoubleMap can be safely cleared.
+ */
+ VM_WARN_ON_ONCE(!PageLocked(page));
+ if (nr == nr_pages && PageDoubleMap(page))
+ ClearPageDoubleMap(page);
+
if (PageSwapBacked(page))
__mod_lruvec_page_state(page, NR_SHMEM_PMDMAPPED,
nr_pages);
_
Patches currently in -mm which might be from hughd@google.com are
memfd-fix-f_seal_write-after-shmem-huge-page-allocated.patch
tmpfs-support-for-file-creation-time-fix.patch
mm-thp-clearpagedoublemap-in-first-page_add_file_rmap.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-03-04 3:55 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-04 3:55 + mm-thp-clearpagedoublemap-in-first-page_add_file_rmap.patch added to -mm tree Andrew Morton
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.