mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Lance Yang <lance.yang@linux.dev>
To: "David Hildenbrand (Arm)" <david@kernel.org>
Cc: akpm@linux-foundation.org, ziy@nvidia.com,
	baolin.wang@linux.alibaba.com, liam@infradead.org,
	nico.pache@linux.dev, ryan.roberts@arm.com, dev.jain@arm.com,
	baohua@kernel.org, usama.arif@linux.dev, kas@kernel.org,
	ljs@kernel.org, surenb@google.com, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH 1/1] mm/huge_memory: fix pgtable withdrawal for huge zero PMDs
Date: Wed, 16 Sep 2026 14:44:52 +0800	[thread overview]
Message-ID: <0efbf471-b74e-4dfa-9335-f1720854d880@linux.dev> (raw)
In-Reply-To: <f784fec5-7261-4ebe-803e-eb26141a0fdc@kernel.org>



On 2026/9/16 14:11, David Hildenbrand (Arm) wrote:
> On 9/16/26 06:41, Lance Yang wrote:
>>
>> On Tue, Sep 15, 2026 at 05:13:17PM +0200, David Hildenbrand (Arm) wrote:
>> [...]
>>>
>>> Ok, it's really only DAX and anonymous VMAs that use the huge zero folio. Other
>>> (module) code would have a hard time using it, as mm_get_huge_zero_folio() is
>>> not exported to modules.
>>>
>>> DAX uses dax_pmd_load_hole()->vmf_insert_folio_pmd()->insert_pmd() where we
>>> deposit a page table only if arch_needs_pgtable_deposit().
>>>
>>>
>>> So I think the rule is simply:
>>>
>>> arch_needs_pgtable_deposit() -> always deposited
>>> vma_is_anonymous() -> always deposited
>>>
>>> ?
>>
>> YES!
>>
>>>
>>> The trick is that we don't have anon THPs in non-anon VMAs.
>>>
>>> So could this be simplified further or am I missing something?
>>
>> Ah, cool! I hadn't thought of that :) You're right, anon THPs cannot live
>> in non-anon VMAs, so pmdval and folio aren't needed here. Will simplify
>> it as suggested :) and add a comment explaining the rule.
>>
>> static bool has_deposited_pgtable(struct vm_area_struct *vma)
>> {
>> 	return arch_needs_pgtable_deposit() || vma_is_anonymous(vma);
>> }
> 
> Yes, that's what I had in mind. (while at it, maybe call it "vma_has_*)

Good point, will do. Thanks!


      reply	other threads:[~2026-09-16  6:45 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-13  5:19 Lance Yang
2026-09-13  6:46 ` Andrew Morton
2026-09-13  7:23   ` Lance Yang
2026-09-14 10:59     ` Kiryl Shutsemau
2026-09-14 14:29       ` David Hildenbrand (Arm)
2026-09-14 18:19         ` Andrew Morton
2026-09-15 13:43           ` Lance Yang
2026-09-15 13:52             ` Kiryl Shutsemau
2026-09-15 15:03               ` David Hildenbrand (Arm)
2026-09-15 15:13 ` David Hildenbrand (Arm)
2026-09-16  4:41   ` Lance Yang
2026-09-16  6:11     ` David Hildenbrand (Arm)
2026-09-16  6:44       ` Lance Yang [this message]

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=0efbf471-b74e-4dfa-9335-f1720854d880@linux.dev \
    --to=lance.yang@linux.dev \
    --cc=akpm@linux-foundation.org \
    --cc=baohua@kernel.org \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=david@kernel.org \
    --cc=dev.jain@arm.com \
    --cc=kas@kernel.org \
    --cc=liam@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ljs@kernel.org \
    --cc=nico.pache@linux.dev \
    --cc=ryan.roberts@arm.com \
    --cc=stable@vger.kernel.org \
    --cc=surenb@google.com \
    --cc=usama.arif@linux.dev \
    --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

all inboxes | Powered by JetHome®