diff options
author | Andrew Morton <akpm@linux-foundation.org> | 2024-04-25 20:59:48 -0700 |
---|---|---|
committer | Andrew Morton <akpm@linux-foundation.org> | 2024-04-25 20:59:48 -0700 |
commit | 1025b1edfc8a9fe8999ceb9c7d24d756f4eb1836 (patch) | |
tree | bc5333aba7efcec91645c9b43bb871e059a064d4 | |
parent | 6e9c1bafbc2dd9675ae6ebdf30505a904402453e (diff) | |
download | 25-new-1025b1edfc8a9fe8999ceb9c7d24d756f4eb1836.tar.gz |
foo
-rw-r--r-- | patches/mm-convert-folio_estimated_sharers-to-folio_likely_mapped_shared.patch | 42 |
1 files changed, 23 insertions, 19 deletions
diff --git a/patches/mm-convert-folio_estimated_sharers-to-folio_likely_mapped_shared.patch b/patches/mm-convert-folio_estimated_sharers-to-folio_likely_mapped_shared.patch index ffdc537ce..fbf486642 100644 --- a/patches/mm-convert-folio_estimated_sharers-to-folio_likely_mapped_shared.patch +++ b/patches/mm-convert-folio_estimated_sharers-to-folio_likely_mapped_shared.patch @@ -21,6 +21,8 @@ This change should currently only affect the usage in madvise_free_pte_range() and queue_folios_pte_range() for large folios: if the first page was already unmapped, we would have skipped the folio. +[david@redhat.com: folio_likely_mapped_shared() kerneldoc fixup] + Link: https://lkml.kernel.org/r/dd0ad9f2-2d7a-45f3-9ba3-979488c7dd27@redhat.com Link: https://lkml.kernel.org/r/20240227201548.857831-1-david@redhat.com Signed-off-by: David Hildenbrand <david@redhat.com> Reviewed-by: Khalid Aziz <khalid.aziz@oracle.com> @@ -31,17 +33,17 @@ Reviewed-by: Zi Yan <ziy@nvidia.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> --- - include/linux/mm.h | 46 +++++++++++++++++++++++++++++++++---------- + include/linux/mm.h | 48 ++++++++++++++++++++++++++++++++++--------- mm/huge_memory.c | 2 - mm/madvise.c | 6 ++--- mm/memory.c | 2 - - mm/mempolicy.c | 14 +++++-------- + mm/mempolicy.c | 14 +++++------- mm/migrate.c | 8 +++---- - 6 files changed, 51 insertions(+), 27 deletions(-) + 6 files changed, 53 insertions(+), 27 deletions(-) --- a/include/linux/mm.h~mm-convert-folio_estimated_sharers-to-folio_likely_mapped_shared +++ a/include/linux/mm.h -@@ -2165,21 +2165,47 @@ static inline size_t folio_size(struct f +@@ -2165,21 +2165,49 @@ static inline size_t folio_size(struct f } /** @@ -71,23 +73,25 @@ Signed-off-by: Andrew Morton <akpm@linux-foundation.org> + * at most once into an MM, and they cannot be partially mapped. + * + * For other folios, the result can be fuzzy: -+ * (a) For partially-mappable large folios (THP), the return value can wrongly -+ * indicate "mapped exclusively" (false negative) when the folio is -+ * only partially mapped into at least one MM. -+ * (b) For pagecache folios (including hugetlb), the return value can wrongly -+ * indicate "mapped shared" (false positive) when two VMAs in the same MM -+ * cover the same file range. -+ * (c) For (small) KSM folios, the return value can wrongly indicate "mapped -+ * shared" (false negative), when the folio is mapped multiple times into -+ * the same MM. ++ * #. For partially-mappable large folios (THP), the return value can wrongly ++ * indicate "mapped exclusively" (false negative) when the folio is ++ * only partially mapped into at least one MM. ++ * #. For pagecache folios (including hugetlb), the return value can wrongly ++ * indicate "mapped shared" (false positive) when two VMAs in the same MM ++ * cover the same file range. ++ * #. For (small) KSM folios, the return value can wrongly indicate "mapped ++ * shared" (false negative), when the folio is mapped multiple times into ++ * the same MM. + * + * Further, this function only considers current page table mappings that -+ * are tracked using the folio mapcount(s). It does not consider: -+ * (1) If the folio might get mapped in the (near) future (e.g., swapcache, -+ * pagecache, temporary unmapping for migration). -+ * (2) If the folio is mapped differently (VM_PFNMAP). -+ * (3) If hugetlb page table sharing applies. Callers might want to check -+ * hugetlb_pmd_shared(). ++ * are tracked using the folio mapcount(s). ++ * ++ * This function does not consider: ++ * #. If the folio might get mapped in the (near) future (e.g., swapcache, ++ * pagecache, temporary unmapping for migration). ++ * #. If the folio is mapped differently (VM_PFNMAP). ++ * #. If hugetlb page table sharing applies. Callers might want to check ++ * hugetlb_pmd_shared(). + * + * Return: Whether the folio is estimated to be mapped into more than one MM. */ |