From: Muchun Song <muchun.song@linux.dev>
To: "Jose A. Perez de Azpillaga" <azpijr@gmail.com>
Cc: "Andrew Morton" <akpm@linux-foundation.org>,
"Muchun Song" <songmuchun@bytedance.com>,
"David Hildenbrand" <david@kernel.org>,
"Oscar Salvador" <osalvador@suse.de>,
"Dave Hansen" <dave.hansen@intel.com>,
"Paul Walmsley" <pjw@kernel.org>,
"Palmer Dabbelt" <palmer@dabbelt.com>,
"Albert Ou" <aou@eecs.berkeley.edu>,
"Alexandre Ghiti" <alex@ghiti.fr>,
"Björn Töpel" <bjorn@rivosinc.com>,
"Catalin Marinas" <catalin.marinas@arm.com>,
"Will Deacon" <will@kernel.org>,
"Mark Rutland" <mark.rutland@arm.com>,
"Kevin Brodsky" <kevin.brodsky@arm.com>,
"Alexander Gordeev" <agordeev@linux.ibm.com>,
"Alistair Popple" <apopple@nvidia.com>,
linux-mm@kvack.org, linux-riscv@lists.infradead.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH v2 1/4] mm: fix missing page-table destructor in pagetable_free()
Date: Tue, 13 Oct 2026 14:33:49 +0800 [thread overview]
Message-ID: <2B2F2818-9309-450B-A2A4-9F53D802F1C6@linux.dev> (raw)
In-Reply-To: <3ab63358-8bbe-4457-b21c-bb81bca804cc@gmail.com>
> On Oct 13, 2026, at 01:21, Jose A. Perez de Azpillaga <azpijr@gmail.com> wrote:
>
> On 10/12/26 2:55 PM, Muchun Song wrote:
>>
>>
>>> On Oct 12, 2026, at 19:15, Jose A. Perez de Azpillaga <azpijr@gmail.com> wrote:
>>>
>>> On Sat, Oct 10, 2026 at 07:24:54PM +0800, Muchun Song wrote:
>>>> Since commit 49f599666420 ("mm: call ctor/dtor for kernel PTEs"),
>>>> pte_alloc_one_kernel() runs the page-table constructor for kernel PTE
>>>> tables.
>>>>
>>>> HVO (HugeTLB Vmemmap Optimization) uses pte_alloc_one_kernel() when
>>>> splitting a PMD. Restoring the vmemmap backing pages does not collapse
>>>> the PTE table, so a later memory hot-remove eventually frees it through
>>>> pagetable_free() on x86-64. That releases the page without running the
>>>> matching destructor and leaves NR_PAGETABLE elevated.
>>>>
>>>> Make pagetable_free() detect constructor-backed pages and run the
>>>> destructor before releasing their memory to fix the problem.
>>>>
>>>> Fixes: 49f599666420 ("mm: call ctor/dtor for kernel PTEs")
>>>> Cc: stable@vger.kernel.org
>>>
>>> is the x86 case covered for 6.16-6.18? as far as I can see, x86
>>> free_pagetable() only uses pagetable_free() since bf9e4e30f353
>>> ("x86/mm: use pagetable_free()") in v6.19, so the backport wouldn't
>>> change anything there. or am I missing something?
>>
>> Yes, you are absolutely right — thanks for catching this.
>>
>> I double-checked and indeed x86's free_pagetable() only starts using
>> pagetable_free() since bf9e4e30f353 ("x86/mm: use pagetable_free()"),
>> which landed in v6.19. So for 6.16-6.18 the prerequisite is not present
>> and the backport would be a no-op there.
>>
>> The correct trailer is:
>>
>> Cc: <stable@vger.kernel.org> # 6.16-6.18: bf9e4e30f353: x86/mm: use pagetable_free()
>
> also, bf9e4e30f353 alone leaks PMD-sized vmemmap pages on those trees,
> it needs 39406c05f8f1 ("x86/mm: Fix freeing of PMD-sized vmemmap pages")
> as well :)
Yeah, you are so meticulous.
>
> Reviewed-by: Jose A. Perez de Azpillaga <azpijr@gmail.com>
>
Thanks.
> --
> cheers,
> jose a. p-a
WARNING: multiple messages have this Message-ID (diff)
From: Muchun Song <muchun.song@linux.dev>
To: "Jose A. Perez de Azpillaga" <azpijr@gmail.com>
Cc: "Andrew Morton" <akpm@linux-foundation.org>,
"Muchun Song" <songmuchun@bytedance.com>,
"David Hildenbrand" <david@kernel.org>,
"Oscar Salvador" <osalvador@suse.de>,
"Dave Hansen" <dave.hansen@intel.com>,
"Paul Walmsley" <pjw@kernel.org>,
"Palmer Dabbelt" <palmer@dabbelt.com>,
"Albert Ou" <aou@eecs.berkeley.edu>,
"Alexandre Ghiti" <alex@ghiti.fr>,
"Björn Töpel" <bjorn@rivosinc.com>,
"Catalin Marinas" <catalin.marinas@arm.com>,
"Will Deacon" <will@kernel.org>,
"Mark Rutland" <mark.rutland@arm.com>,
"Kevin Brodsky" <kevin.brodsky@arm.com>,
"Alexander Gordeev" <agordeev@linux.ibm.com>,
"Alistair Popple" <apopple@nvidia.com>,
linux-mm@kvack.org, linux-riscv@lists.infradead.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH v2 1/4] mm: fix missing page-table destructor in pagetable_free()
Date: Tue, 13 Oct 2026 14:33:49 +0800 [thread overview]
Message-ID: <2B2F2818-9309-450B-A2A4-9F53D802F1C6@linux.dev> (raw)
In-Reply-To: <3ab63358-8bbe-4457-b21c-bb81bca804cc@gmail.com>
> On Oct 13, 2026, at 01:21, Jose A. Perez de Azpillaga <azpijr@gmail.com> wrote:
>
> On 10/12/26 2:55 PM, Muchun Song wrote:
>>
>>
>>> On Oct 12, 2026, at 19:15, Jose A. Perez de Azpillaga <azpijr@gmail.com> wrote:
>>>
>>> On Sat, Oct 10, 2026 at 07:24:54PM +0800, Muchun Song wrote:
>>>> Since commit 49f599666420 ("mm: call ctor/dtor for kernel PTEs"),
>>>> pte_alloc_one_kernel() runs the page-table constructor for kernel PTE
>>>> tables.
>>>>
>>>> HVO (HugeTLB Vmemmap Optimization) uses pte_alloc_one_kernel() when
>>>> splitting a PMD. Restoring the vmemmap backing pages does not collapse
>>>> the PTE table, so a later memory hot-remove eventually frees it through
>>>> pagetable_free() on x86-64. That releases the page without running the
>>>> matching destructor and leaves NR_PAGETABLE elevated.
>>>>
>>>> Make pagetable_free() detect constructor-backed pages and run the
>>>> destructor before releasing their memory to fix the problem.
>>>>
>>>> Fixes: 49f599666420 ("mm: call ctor/dtor for kernel PTEs")
>>>> Cc: stable@vger.kernel.org
>>>
>>> is the x86 case covered for 6.16-6.18? as far as I can see, x86
>>> free_pagetable() only uses pagetable_free() since bf9e4e30f353
>>> ("x86/mm: use pagetable_free()") in v6.19, so the backport wouldn't
>>> change anything there. or am I missing something?
>>
>> Yes, you are absolutely right — thanks for catching this.
>>
>> I double-checked and indeed x86's free_pagetable() only starts using
>> pagetable_free() since bf9e4e30f353 ("x86/mm: use pagetable_free()"),
>> which landed in v6.19. So for 6.16-6.18 the prerequisite is not present
>> and the backport would be a no-op there.
>>
>> The correct trailer is:
>>
>> Cc: <stable@vger.kernel.org> # 6.16-6.18: bf9e4e30f353: x86/mm: use pagetable_free()
>
> also, bf9e4e30f353 alone leaks PMD-sized vmemmap pages on those trees,
> it needs 39406c05f8f1 ("x86/mm: Fix freeing of PMD-sized vmemmap pages")
> as well :)
Yeah, you are so meticulous.
>
> Reviewed-by: Jose A. Perez de Azpillaga <azpijr@gmail.com>
>
Thanks.
> --
> cheers,
> jose a. p-a
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
next prev parent reply other threads:[~2026-10-13 6:34 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-10 11:24 [PATCH v2 0/4] mm: Fix page-table teardown during memory hot-remove Muchun Song
2026-10-10 11:24 ` Muchun Song
2026-10-10 11:24 ` [PATCH v2 1/4] mm: fix missing page-table destructor in pagetable_free() Muchun Song
2026-10-10 11:24 ` Muchun Song
2026-10-12 11:15 ` Jose A. Perez de Azpillaga
2026-10-12 11:15 ` Jose A. Perez de Azpillaga
2026-10-12 12:55 ` Muchun Song
2026-10-12 12:55 ` Muchun Song
2026-10-12 17:21 ` Jose A. Perez de Azpillaga
2026-10-12 17:21 ` Jose A. Perez de Azpillaga
2026-10-13 6:33 ` Muchun Song [this message]
2026-10-13 6:33 ` Muchun Song
2026-10-13 2:31 ` Andrew Morton
2026-10-13 2:31 ` Andrew Morton
2026-10-13 2:50 ` Muchun Song
2026-10-13 2:50 ` Muchun Song
2026-10-13 3:25 ` Andrew Morton
2026-10-13 3:25 ` Andrew Morton
2026-10-13 6:26 ` Muchun Song
2026-10-13 6:26 ` Muchun Song
2026-10-12 13:27 ` David Hildenbrand (Arm)
2026-10-12 13:27 ` David Hildenbrand (Arm)
2026-10-12 13:29 ` Muchun Song
2026-10-12 13:29 ` Muchun Song
2026-10-12 14:06 ` Dave Hansen
2026-10-12 14:06 ` Dave Hansen
2026-10-10 11:24 ` [PATCH v2 2/4] riscv/mm: fix hotplug page-table destructor handling Muchun Song
2026-10-10 11:24 ` Muchun Song
2026-10-12 13:28 ` David Hildenbrand (Arm)
2026-10-12 13:28 ` David Hildenbrand (Arm)
2026-10-12 15:32 ` Björn Töpel
2026-10-12 15:32 ` Björn Töpel
2026-10-10 11:24 ` [PATCH v2 3/4] riscv/mm: fix missing destructor for hotplug PUD tables Muchun Song
2026-10-10 11:24 ` Muchun Song
2026-10-12 15:35 ` Björn Töpel
2026-10-12 15:35 ` Björn Töpel
2026-10-10 11:24 ` [PATCH v2 4/4] arm64/mm: fix destructor for unconstructed hotplug page tables Muchun Song
2026-10-10 11:24 ` Muchun Song
2026-10-12 13:30 ` David Hildenbrand (Arm)
2026-10-12 13:30 ` David Hildenbrand (Arm)
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=2B2F2818-9309-450B-A2A4-9F53D802F1C6@linux.dev \
--to=muchun.song@linux.dev \
--cc=agordeev@linux.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=alex@ghiti.fr \
--cc=aou@eecs.berkeley.edu \
--cc=apopple@nvidia.com \
--cc=azpijr@gmail.com \
--cc=bjorn@rivosinc.com \
--cc=catalin.marinas@arm.com \
--cc=dave.hansen@intel.com \
--cc=david@kernel.org \
--cc=kevin.brodsky@arm.com \
--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=mark.rutland@arm.com \
--cc=osalvador@suse.de \
--cc=palmer@dabbelt.com \
--cc=pjw@kernel.org \
--cc=songmuchun@bytedance.com \
--cc=stable@vger.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.