From: Muchun Song <muchun.song@linux.dev>
To: "David Hildenbrand (Arm)" <david@kernel.org>
Cc: Muchun Song <songmuchun@bytedance.com>,
Andrew Morton <akpm@linux-foundation.org>,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will@kernel.org>,
Palmer Dabbelt <palmer@dabbelt.com>,
Paul Walmsley <pjw@kernel.org>,
Huacai Chen <chenhuacai@kernel.org>,
Andreas Larsson <andreas@gaisler.com>,
"David S. Miller" <davem@davemloft.net>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-riscv@lists.infradead.org, loongarch@lists.linux.dev,
sparclinux@vger.kernel.org, Alexandre Ghiti <alex@ghiti.fr>,
Albert Ou <aou@eecs.berkeley.edu>,
WANG Xuerui <kernel@xen0n.name>, Lorenzo Stoakes <ljs@kernel.org>,
"Liam R. Howlett" <liam@infradead.org>,
Vlastimil Babka <vbabka@kernel.org>,
Mike Rapoport <rppt@kernel.org>,
Suren Baghdasaryan <surenb@google.com>,
Michal Hocko <mhocko@suse.com>
Subject: Re: [PATCH v3 1/5] mm/sparse-vmemmap: provide generic vmemmap_set_pmd() and vmemmap_check_pmd()
Date: Mon, 1 Jun 2026 20:37:42 +0800 [thread overview]
Message-ID: <0D4AF42F-37C5-4A76-9703-44ACC6374C48@linux.dev> (raw)
In-Reply-To: <db8d440d-c8a1-4f77-b5d9-00bab8737f12@kernel.org>
> On Jun 1, 2026, at 20:22, David Hildenbrand (Arm) <david@kernel.org> wrote:
>
> On 6/1/26 10:48, Muchun Song wrote:
>> The two weak functions are currently no-ops on every architecture,
>> forcing each platform that needs them to duplicate the same handful
>> of lines. Provide a generic implementation:
>>
>> - vmemmap_set_pmd() simply sets a huge PMD with PAGE_KERNEL protection.
>>
>> - vmemmap_check_pmd() verifies that the PMD is present and leaf,
>> then calls the existing vmemmap_verify() helper.
>>
>> Architectures that need special handling can continue to override the
>> weak symbols; everyone else gets the standard version for free.
>>
>> Signed-off-by: Muchun Song <songmuchun@bytedance.com>
>> ---
>> v2->v3:
>> - Replace BUG_ON() with WARN_ON_ONCE() in vmemmap_set_pmd()
>> ---
>> mm/sparse-vmemmap.c | 7 ++++++-
>> 1 file changed, 6 insertions(+), 1 deletion(-)
>>
>> diff --git a/mm/sparse-vmemmap.c b/mm/sparse-vmemmap.c
>> index 112ccf9c71ca..99e2be39671b 100644
>> --- a/mm/sparse-vmemmap.c
>> +++ b/mm/sparse-vmemmap.c
>> @@ -386,12 +386,17 @@ int __meminit vmemmap_populate_hvo(unsigned long addr, unsigned long end,
>> void __weak __meminit vmemmap_set_pmd(pmd_t *pmd, void *p, int node,
>> unsigned long addr, unsigned long next)
>> {
>> + WARN_ON_ONCE(!pmd_set_huge(pmd, virt_to_phys(p), PAGE_KERNEL));
>
>
> Not sure if a VM_WARN_ON_ONCE() would be appropriate. (then, we have to move the
> pmd_set_huge() out of the statement).
I think it might be better to keep WARN_ON_ONCE here. This way, we can still
monitor for warnings in production while keeping the code simple.
>
> Acked-by: David Hildenbrand (Arm) <david@kernel.org>
Thanks.
>
>
> --
> Cheers,
>
> David
next prev parent reply other threads:[~2026-06-01 12:38 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-01 8:48 [PATCH v3 0/5] mm/sparse-vmemmap: Provide generic vmemmap_set_pmd() and vmemmap_check_pmd() Muchun Song
2026-06-01 8:48 ` [PATCH v3 1/5] mm/sparse-vmemmap: provide " Muchun Song
2026-06-01 12:22 ` David Hildenbrand (Arm)
2026-06-01 12:37 ` Muchun Song [this message]
2026-06-02 4:40 ` Oscar Salvador (SUSE)
2026-06-02 4:41 ` Oscar Salvador (SUSE)
2026-06-01 8:48 ` [PATCH v3 2/5] arm64/mm: drop vmemmap_pmd helpers and use generic code Muchun Song
2026-06-01 12:23 ` David Hildenbrand (Arm)
2026-06-02 4:42 ` Oscar Salvador (SUSE)
2026-06-01 8:48 ` [PATCH v3 3/5] riscv/mm: " Muchun Song
2026-06-01 12:23 ` David Hildenbrand (Arm)
2026-06-02 4:44 ` Oscar Salvador (SUSE)
2026-06-01 8:48 ` [PATCH v3 4/5] loongarch/mm: drop vmemmap_check_pmd helper " Muchun Song
2026-06-01 12:24 ` David Hildenbrand (Arm)
2026-06-01 12:26 ` Muchun Song
2026-06-02 4:45 ` Oscar Salvador (SUSE)
2026-06-01 8:48 ` [PATCH v3 5/5] sparc/mm: " Muchun Song
2026-06-01 12:25 ` David Hildenbrand (Arm)
2026-06-02 4:46 ` Oscar Salvador (SUSE)
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=0D4AF42F-37C5-4A76-9703-44ACC6374C48@linux.dev \
--to=muchun.song@linux.dev \
--cc=akpm@linux-foundation.org \
--cc=alex@ghiti.fr \
--cc=andreas@gaisler.com \
--cc=aou@eecs.berkeley.edu \
--cc=catalin.marinas@arm.com \
--cc=chenhuacai@kernel.org \
--cc=davem@davemloft.net \
--cc=david@kernel.org \
--cc=kernel@xen0n.name \
--cc=liam@infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-riscv@lists.infradead.org \
--cc=ljs@kernel.org \
--cc=loongarch@lists.linux.dev \
--cc=mhocko@suse.com \
--cc=palmer@dabbelt.com \
--cc=pjw@kernel.org \
--cc=rppt@kernel.org \
--cc=songmuchun@bytedance.com \
--cc=sparclinux@vger.kernel.org \
--cc=surenb@google.com \
--cc=vbabka@kernel.org \
--cc=will@kernel.org \
/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