PAGEMAP_SCAN already reports PAGE_IS_WRITTEN from the inverted uffd PTE bit, targeting the UFFDIO_WRITEPROTECT workflow. UFFDIO_RWPROTECT reuses the same PTE bit as a marker for read-write protection, but "has been written" and "has been accessed" are distinct semantic signals — they happen to share one PTE bit today only because the two implementations share infrastructure. Give RWP its own pagemap category so the UAPI does not conflate them: PAGE_IS_WRITTEN reported on VM_UFFD_WP VMAs, !pte_uffd(pte) PAGE_IS_ACCESSED reported on VM_UFFD_RWP VMAs, !pte_uffd(pte) Both still read the same PTE bit today, but each is scoped to the VMA whose registered mode makes the bit meaningful. If a future implementation moves RWP to a separate PTE bit, only PAGE_IS_ACCESSED switches over. This is a UAPI narrowing. Outside VM_UFFD_WP VMAs the uffd bit is always clear, so PAGEMAP_SCAN used to flag PAGE_IS_WRITTEN on every present PTE there — a meaningless duplicate of PAGE_IS_PRESENT. Now PAGE_IS_WRITTEN fires only inside VM_UFFD_WP VMAs. pagemap_hugetlb_category() now takes the vma like its PTE/PMD peers.
Showing the changes to include/uapi/linux (1 of 4 files). Show all
Unified · Split
| @@ -471,6 +471,7 @@ typedef int __bitwise __kernel_rwf_t; · 470 unmodified lines | |||
| 471 | #define PAGE_IS_HUGE (1 << 6) | 471 | #define PAGE_IS_HUGE (1 << 6) |
| 472 | #define PAGE_IS_SOFT_DIRTY (1 << 7) | 472 | #define PAGE_IS_SOFT_DIRTY (1 << 7) |
| 473 | #define PAGE_IS_GUARD (1 << 8) | 473 | #define PAGE_IS_GUARD (1 << 8) |
| 474 | #define PAGE_IS_ACCESSED (1 << 9) | ||
| 474 | 475 | ||
| 475 | /* | 476 | /* |
| 476 | * struct page_region - Page region with flags | 477 | * struct page_region - Page region with flags |