[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMZfGtXmDhkCWateAR0q_EgRPDmGh_=D-6UuhMd+Si6=TDvghQ@mail.gmail.com>
Date: Wed, 21 Apr 2021 11:41:24 +0800
From: Muchun Song <songmuchun@...edance.com>
To: Oscar Salvador <osalvador@...e.de>
Cc: Jonathan Corbet <corbet@....net>,
Mike Kravetz <mike.kravetz@...cle.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, bp@...en8.de,
X86 ML <x86@...nel.org>, hpa@...or.com,
dave.hansen@...ux.intel.com, luto@...nel.org,
Peter Zijlstra <peterz@...radead.org>,
Alexander Viro <viro@...iv.linux.org.uk>,
Andrew Morton <akpm@...ux-foundation.org>, paulmck@...nel.org,
pawan.kumar.gupta@...ux.intel.com,
Randy Dunlap <rdunlap@...radead.org>, oneukum@...e.com,
anshuman.khandual@....com, jroedel@...e.de,
Mina Almasry <almasrymina@...gle.com>,
David Rientjes <rientjes@...gle.com>,
Matthew Wilcox <willy@...radead.org>,
Michal Hocko <mhocko@...e.com>,
"Song Bao Hua (Barry Song)" <song.bao.hua@...ilicon.com>,
David Hildenbrand <david@...hat.com>,
HORIGUCHI NAOYA(堀口 直也)
<naoya.horiguchi@....com>,
Joao Martins <joao.m.martins@...cle.com>,
Xiongchun duan <duanxiongchun@...edance.com>,
fam.zheng@...edance.com, linux-doc@...r.kernel.org,
LKML <linux-kernel@...r.kernel.org>,
Linux Memory Management List <linux-mm@...ck.org>,
linux-fsdevel <linux-fsdevel@...r.kernel.org>
Subject: Re: [External] Re: [PATCH v20 8/9] mm: memory_hotplug: disable
memmap_on_memory when hugetlb_free_vmemmap enabled
On Tue, Apr 20, 2021 at 6:35 PM Oscar Salvador <osalvador@...e.de> wrote:
>
> On Thu, Apr 15, 2021 at 04:40:04PM +0800, Muchun Song wrote:
> > bool mhp_supports_memmap_on_memory(unsigned long size)
> > {
> > + bool supported;
> > unsigned long nr_vmemmap_pages = size / PAGE_SIZE;
> > unsigned long vmemmap_size = nr_vmemmap_pages * sizeof(struct page);
> > unsigned long remaining_size = size - vmemmap_size;
> > @@ -1011,11 +1012,18 @@ bool mhp_supports_memmap_on_memory(unsigned long size)
> > * altmap as an alternative source of memory, and we do not exactly
> > * populate a single PMD.
> > */
> > - return memmap_on_memory &&
> > - IS_ENABLED(CONFIG_MHP_MEMMAP_ON_MEMORY) &&
> > - size == memory_block_size_bytes() &&
> > - IS_ALIGNED(vmemmap_size, PMD_SIZE) &&
> > - IS_ALIGNED(remaining_size, pageblock_nr_pages << PAGE_SHIFT);
> > + supported = memmap_on_memory &&
> > + IS_ENABLED(CONFIG_MHP_MEMMAP_ON_MEMORY) &&
> > + size == memory_block_size_bytes() &&
> > + IS_ALIGNED(vmemmap_size, PMD_SIZE) &&
> > + IS_ALIGNED(remaining_size, pageblock_nr_pages << PAGE_SHIFT);
> > +
> > + if (supported && is_hugetlb_free_vmemmap_enabled()) {
> > + pr_info("Cannot enable memory_hotplug.memmap_on_memory, it is not compatible with hugetlb_free_vmemmap\n");
> > + supported = false;
> > + }
>
> I would not print anything and rather have
>
> return memmap_on_memory &&
> !is_hugetlb_free_vmemmap_enabled &&
> IS_ENABLED(CONFIG_MHP_MEMMAP_ON_MEMORY) &&
> size == memory_block_size_bytes() &&
> IS_ALIGNED(vmemmap_size, PMD_SIZE) &&
> IS_ALIGNED(remaining_size, pageblock_nr_pages << PAGE_SHIFT);
OK. Will do.
>
> Documentation/admin-guide/kernel-parameters.txt already provides an
> explanation on memory_hotplug.memmap_on_memory parameter that states
> that the feature cannot be enabled when using hugetlb-vmemmap
> optimization.
>
> Users can always check whether the feature is enabled via
> /sys/modules/memory_hotplug/parameters/memmap_on_memory.
If memory_hotplug.memmap_on_memory is enabled
$ cat /sys/module/memory_hotplug/parameters/memmap_on_memory
$ Y
If memory_hotplug.memmap_on_memory is disabled
$ cat /sys/module/memory_hotplug/parameters/memmap_on_memory
$ N
>
> Also, I did not check if it is, but if not, the fact about hugetlb-vmemmmap vs
> hotplug-vmemmap should also be called out in the hugetlb-vmemmap kernel
> parameter.
Make sense. I will update the doc.
Thanks.
>
> Thanks
>
> --
> Oscar Salvador
> SUSE L3
Powered by blists - more mailing lists