Re: [PATCH v32 2/6] fs/proc/task_mmu: Implement IOCTL to get and optionally clear info about PTEs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 8/19/23 6:04 AM, Michał Mirosław wrote:
> 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
I didn't know about this. It seems like khugepaged can create file THPs.
Not sure if there is direct way to create file backed THPs. Maybe they'll
add this support after adding writing support to these file backed THPs.
READ_ONLY_THP_FOR_FS mentions this.

I can add a few lines of code for this here.

> 
>> +	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

-- 
BR,
Muhammad Usama Anjum



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux