Skip to content

Commit 88e4e47

Browse files
davidhildenbrandakpm00
authored andcommitted
fs/proc/task_mmu: convert pagemap_hugetlb_range() to work on folios
Patch series "fs/proc/task_mmu: convert hugetlb functions to work on folis". Let's convert two more functions, getting rid of two more page_mapcount() calls. This patch (of 2): Let's get rid of another page_mapcount() check and simply use folio_likely_mapped_shared(), which is precise for hugetlb folios. While at it, also check for PMD table sharing, like we do in smaps_hugetlb_range(). No functional change intended, except that we would now detect hugetlb folios shared via PMD table sharing correctly. Link: https://lkml.kernel.org/r/[email protected] Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: David Hildenbrand <[email protected]> Reviewed-by: Oscar Salvador <[email protected]> Cc: Muchun Song <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 122ff80 commit 88e4e47

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

fs/proc/task_mmu.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1578,12 +1578,13 @@ static int pagemap_hugetlb_range(pte_t *ptep, unsigned long hmask,
15781578

15791579
pte = huge_ptep_get(ptep);
15801580
if (pte_present(pte)) {
1581-
struct page *page = pte_page(pte);
1581+
struct folio *folio = page_folio(pte_page(pte));
15821582

1583-
if (!PageAnon(page))
1583+
if (!folio_test_anon(folio))
15841584
flags |= PM_FILE;
15851585

1586-
if (page_mapcount(page) == 1)
1586+
if (!folio_likely_mapped_shared(folio) &&
1587+
!hugetlb_pmd_shared(ptep))
15871588
flags |= PM_MMAP_EXCLUSIVE;
15881589

15891590
if (huge_pte_uffd_wp(pte))

0 commit comments

Comments
 (0)