On Wed, Aug 16, 2023 at 04:30:45PM +0500, Muhammad Usama Anjum wrote: > The PAGEMAP_SCAN IOCTL on the pagemap file can be used to get or optionally > clear the info about page table entries. [...] > --- a/fs/proc/task_mmu.c > +++ b/fs/proc/task_mmu.c [...] > +#ifdef CONFIG_TRANSPARENT_HUGEPAGE > +static unsigned long pagemap_thp_category(pmd_t pmd) > +{ > + unsigned long categories = PAGE_IS_HUGE; > + > + /* > + * THPs don't support file-backed memory. So PAGE_IS_FILE > + * is not checked here. > + */ It seems that we can have THP for files: ref. recent LKML thread [1]. [1] https://lkml.org/lkml/2023/8/16/1212 > + if (pmd_present(pmd)) { > + categories |= PAGE_IS_PRESENT; > + if (!pmd_uffd_wp(pmd)) > + categories |= PAGE_IS_WRITTEN; > + if (is_zero_pfn(pmd_pfn(pmd))) > + categories |= PAGE_IS_PFNZERO; > + } else if (is_swap_pmd(pmd)) { > + categories |= PAGE_IS_SWAPPED; > + if (!pmd_swp_uffd_wp(pmd)) > + categories |= PAGE_IS_WRITTEN; > + } > + > + return categories; > +} Best Regards Michał Mirosław