[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <31dd1efc-ccf3-4908-a06f-20dabac86ce1@redhat.com>
Date: Wed, 28 May 2025 22:36:33 +0200
From: David Hildenbrand <david@...hat.com>
To: "Pankaj Raghav (Samsung)" <kernel@...kajraghav.com>,
Dave Hansen <dave.hansen@...el.com>
Cc: Pankaj Raghav <p.raghav@...sung.com>,
Suren Baghdasaryan <surenb@...gle.com>, Ryan Roberts <ryan.roberts@....com>,
Vlastimil Babka <vbabka@...e.cz>, Baolin Wang
<baolin.wang@...ux.alibaba.com>, Borislav Petkov <bp@...en8.de>,
Ingo Molnar <mingo@...hat.com>, "H . Peter Anvin" <hpa@...or.com>,
Zi Yan <ziy@...dia.com>, Mike Rapoport <rppt@...nel.org>,
Dave Hansen <dave.hansen@...ux.intel.com>, Michal Hocko <mhocko@...e.com>,
Lorenzo Stoakes <lorenzo.stoakes@...cle.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Thomas Gleixner <tglx@...utronix.de>, Nico Pache <npache@...hat.com>,
Dev Jain <dev.jain@....com>, "Liam R . Howlett" <Liam.Howlett@...cle.com>,
Jens Axboe <axboe@...nel.dk>, linux-kernel@...r.kernel.org,
linux-mm@...ck.org, linux-block@...r.kernel.org, willy@...radead.org,
x86@...nel.org, linux-fsdevel@...r.kernel.org,
"Darrick J . Wong" <djwong@...nel.org>, mcgrof@...nel.org,
gost.dev@...sung.com, hch@....de
Subject: Re: [RFC 2/3] mm: add STATIC_PMD_ZERO_PAGE config option
On 27.05.25 20:00, Pankaj Raghav (Samsung) wrote:
> On Tue, May 27, 2025 at 09:37:50AM -0700, Dave Hansen wrote:
>>> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
>>> index 055204dc211d..96f99b4f96ea 100644
>>> --- a/arch/x86/Kconfig
>>> +++ b/arch/x86/Kconfig
>>> @@ -152,6 +152,7 @@ config X86
>>> select ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP if X86_64
>>> select ARCH_WANT_HUGETLB_VMEMMAP_PREINIT if X86_64
>>> select ARCH_WANTS_THP_SWAP if X86_64
>>> + select ARCH_WANTS_STATIC_PMD_ZERO_PAGE if X86_64
>>
>> I don't think this should be the default. There are lots of little
>> x86_64 VMs sitting around and 2MB might be significant to them.
>
> This is the feedback I wanted. I will make it optional.
>
>>> +config ARCH_WANTS_STATIC_PMD_ZERO_PAGE
>>> + bool
>>> +
>>> +config STATIC_PMD_ZERO_PAGE
>>> + def_bool y
>>> + depends on ARCH_WANTS_STATIC_PMD_ZERO_PAGE
>>> + help
>>> + Typically huge_zero_folio, which is a PMD page of zeroes, is allocated
>>> + on demand and deallocated when not in use. This option will always
>>> + allocate huge_zero_folio for zeroing and it is never deallocated.
>>> + Not suitable for memory constrained systems.
>>
>> "Static" seems like a weird term to use for this. I was really expecting
>> to see a 2MB object that gets allocated in .bss or something rather than
>> a dynamically allocated page that's just never freed.
>
> My first proposal was along those lines[0] (sorry I messed up version
> while sending the patches). David Hilderbrand suggested to leverage the
> infrastructure we already have in huge_memory.
Sorry, maybe I was not 100% clear.
We could either
a) Allocate it statically in bss and reuse it for huge_memory purposes
(static vs. dynamic is a good fit)
b) Allocate it during early boot and never free it.
Assuming we allocate it from memblock, it's almost static ... :)
I would not allocate it at runtime later when requested. Then, "static"
is really a suboptimal fit.
--
Cheers,
David / dhildenb
Powered by blists - more mailing lists