Skip to content

Commit 8e165e7

Browse files
xzpeterakpm00
authored andcommitted
mm/pagemap: recognize uffd-wp bit for shmem/hugetlbfs
This requires the pagemap code to be able to recognize the newly introduced swap special pte for uffd-wp, meanwhile the general case for hugetlb that we recently start to support. It should make pagemap uffd-wp support complete. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Peter Xu <[email protected]> Cc: Alistair Popple <[email protected]> Cc: Andrea Arcangeli <[email protected]> Cc: Axel Rasmussen <[email protected]> Cc: David Hildenbrand <[email protected]> Cc: Hugh Dickins <[email protected]> Cc: Jerome Glisse <[email protected]> Cc: "Kirill A . Shutemov" <[email protected]> Cc: Matthew Wilcox <[email protected]> Cc: Mike Kravetz <[email protected]> Cc: Mike Rapoport <[email protected]> Cc: Nadav Amit <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent deb4c93 commit 8e165e7

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

fs/proc/task_mmu.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1421,6 +1421,8 @@ static pagemap_entry_t pte_to_pagemap_entry(struct pagemapread *pm,
14211421
migration = is_migration_entry(entry);
14221422
if (is_pfn_swap_entry(entry))
14231423
page = pfn_swap_entry_to_page(entry);
1424+
if (pte_marker_entry_uffd_wp(entry))
1425+
flags |= PM_UFFD_WP;
14241426
}
14251427

14261428
if (page && !PageAnon(page))
@@ -1556,10 +1558,15 @@ static int pagemap_hugetlb_range(pte_t *ptep, unsigned long hmask,
15561558
if (page_mapcount(page) == 1)
15571559
flags |= PM_MMAP_EXCLUSIVE;
15581560

1561+
if (huge_pte_uffd_wp(pte))
1562+
flags |= PM_UFFD_WP;
1563+
15591564
flags |= PM_PRESENT;
15601565
if (pm->show_pfn)
15611566
frame = pte_pfn(pte) +
15621567
((addr & ~hmask) >> PAGE_SHIFT);
1568+
} else if (pte_swp_uffd_wp_any(pte)) {
1569+
flags |= PM_UFFD_WP;
15631570
}
15641571

15651572
for (; addr != end; addr += PAGE_SIZE) {

0 commit comments

Comments
 (0)