[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <416514a7-0e0d-4cc8-912e-bcdd2bac5c2e@collabora.com>
Date: Mon, 30 Jun 2025 10:18:17 +0500
From: Muhammad Usama Anjum <usama.anjum@...labora.com>
To: David Hildenbrand <david@...hat.com>,
Andrew Morton <akpm@...ux-foundation.org>
Cc: linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1] fs/proc/task_mmu: fix PAGE_IS_PFNZERO detection for
the huge zero folio
On 6/17/25 7:35 PM, David Hildenbrand wrote:
> is_zero_pfn() does not work for the huge zero folio. Fix it by using
> is_huge_zero_pmd().
>
> Found by code inspection.
>
> Fixes: 52526ca7fdb9 ("fs/proc/task_mmu: implement IOCTL to get and optionally clear info about PTEs")
> Cc: Andrew Morton <akpm@...ux-foundation.org>
> Cc: Muhammad Usama Anjum <usama.anjum@...labora.com>
> Signed-off-by: David Hildenbrand <david@...hat.com>
> ---
>
> Probably we should Cc stable, thoughts?
>
> We should also extend the pagemap_ioctl selftest to cover this case, but I
> don't have time for that right now. @Muhammad ?
Currently, we don't have any test case covering zero pfn. I'm trying to write
a few test cases. But I'm not able to get ZERO PFN. I've tried to allocate a
read only memory and then read it. Is there a trick to how to create ZERO PFN
memory from userspace?
>
> ---
> fs/proc/task_mmu.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
> index 27972c0749e78..4be91eb6ea5ca 100644
> --- a/fs/proc/task_mmu.c
> +++ b/fs/proc/task_mmu.c
> @@ -2182,7 +2182,7 @@ static unsigned long pagemap_thp_category(struct pagemap_scan_private *p,
> categories |= PAGE_IS_FILE;
> }
>
> - if (is_zero_pfn(pmd_pfn(pmd)))
> + if (is_huge_zero_pmd(pmd))
> categories |= PAGE_IS_PFNZERO;
> if (pmd_soft_dirty(pmd))
> categories |= PAGE_IS_SOFT_DIRTY;
Powered by blists - more mailing lists