Re: [External] Re: [PATCH v20 8/9] mm: memory_hotplug: disable memmap_on_memory when hugetlb_free_vmemmap enabled

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Apr 20, 2021 at 6:35 PM Oscar Salvador <osalvador@xxxxxxx> 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



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux