Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "David Hildenbrand (Arm)" <david@kernel.org>
To: Kefeng Wang <wangkefeng.wang@huawei.com>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm@kvack.org, "Liam R . Howlett" <liam@infradead.org>,
	Lorenzo Stoakes <ljs@kernel.org>,
	Vlastimil Babka <vbabka@kernel.org>, Jann Horn <jannh@google.com>,
	Pedro Falcato <pfalcato@suse.de>, Zi Yan <ziy@nvidia.com>
Subject: Re: [PATCH v3 2/6] mm: mincore: remove special handling for VM_PFNMAP
Date: Mon, 20 Jul 2026 10:25:56 +0100	[thread overview]
Message-ID: <5b37358b-cd6b-47aa-8403-4a24fe105379@kernel.org> (raw)
In-Reply-To: <20260717091347.1144789-3-wangkefeng.wang@huawei.com>

On 7/17/26 10:13, Kefeng Wang wrote:
> As David pointed out, "it’s hard to believe that someone depends
> on pages in VM_PFNMAP to *not* be present", so remove the historical
> behavior that always reports VM_PFNMAP pages as non-resident.
> 
> Adding mincore_pud_range() allows the page table walker to traverse
> the full page table hierarchy without splitting a huge PUD, enabling
> much more precise identification of resident pages in PFNMAP VMAs.
> 
> Link: https://lore.kernel.org/linux-mm/0e619d71-1c3d-4534-8376-2982c7348c31@kernel.org/
> Suggested-by: David Hildenbrand (Arm) <david@kernel.org>
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
> ---
>  mm/mincore.c | 24 ++++++++++++++++--------
>  1 file changed, 16 insertions(+), 8 deletions(-)
> 
> diff --git a/mm/mincore.c b/mm/mincore.c
> index 53b982803771..3fccaa5c96f8 100644
> --- a/mm/mincore.c
> +++ b/mm/mincore.c
> @@ -160,6 +160,21 @@ static int mincore_unmapped_range(unsigned long addr, unsigned long end,
>  	return 0;
>  }
>  
> +static int mincore_pud_range(pud_t *pudp, unsigned long addr, unsigned long end,

s/mincore_pud_range/mincore_pud_entry/

> +		struct mm_walk *walk)
> +{
> +	if (pud_is_huge(pudp_get(pudp))) {
> +		int nr = (end - addr) >> PAGE_SHIFT;

Could be const.

> +		unsigned char *vec = walk->private;

Might be able to just cast that as part of the memset.

> +
> +		memset(vec, 1, nr);
> +		walk->action = ACTION_CONTINUE;
> +		walk->private += nr;
> +	}
> +
> +	return 0;
> +}

With the rename

Acked-by: David Hildenbrand (Arm) <david@kernel.org>

-- 
Cheers,

David


  parent reply	other threads:[~2026-07-20  9:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20260717091347.1144789-1-wangkefeng.wang@huawei.com>
     [not found] ` <20260717091347.1144789-2-wangkefeng.wang@huawei.com>
2026-07-20  9:21   ` [PATCH v3 1/6] mm: introduce pud_is_huge() helper David Hildenbrand (Arm)
     [not found] ` <20260717091347.1144789-3-wangkefeng.wang@huawei.com>
2026-07-20  9:25   ` David Hildenbrand (Arm) [this message]
2026-07-20  9:26   ` [PATCH v3 2/6] mm: mincore: remove special handling for VM_PFNMAP David Hildenbrand (Arm)
2026-07-20 12:41   ` [PATCH v3-fixup 2/6] mm: mincore: fixup for " Kefeng Wang
     [not found] ` <20260717091347.1144789-6-wangkefeng.wang@huawei.com>
2026-07-20  9:27   ` [PATCH v3 5/6] mm: mincore: improve mincore_hugetlb() David Hildenbrand (Arm)
2026-07-20 12:42   ` [PATCH v3-fixup 5/6] mm: mincore: fixup " Kefeng Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5b37358b-cd6b-47aa-8403-4a24fe105379@kernel.org \
    --to=david@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=jannh@google.com \
    --cc=liam@infradead.org \
    --cc=linux-mm@kvack.org \
    --cc=ljs@kernel.org \
    --cc=pfalcato@suse.de \
    --cc=vbabka@kernel.org \
    --cc=wangkefeng.wang@huawei.com \
    --cc=ziy@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox