lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YH6udU5rKmDcx5dY@localhost.localdomain>
Date:   Tue, 20 Apr 2021 12:35:33 +0200
From:   Oscar Salvador <osalvador@...e.de>
To:     Muchun Song <songmuchun@...edance.com>
Cc:     corbet@....net, mike.kravetz@...cle.com, tglx@...utronix.de,
        mingo@...hat.com, bp@...en8.de, x86@...nel.org, hpa@...or.com,
        dave.hansen@...ux.intel.com, luto@...nel.org, peterz@...radead.org,
        viro@...iv.linux.org.uk, akpm@...ux-foundation.org,
        paulmck@...nel.org, pawan.kumar.gupta@...ux.intel.com,
        rdunlap@...radead.org, oneukum@...e.com, anshuman.khandual@....com,
        jroedel@...e.de, almasrymina@...gle.com, rientjes@...gle.com,
        willy@...radead.org, mhocko@...e.com, song.bao.hua@...ilicon.com,
        david@...hat.com, naoya.horiguchi@....com,
        joao.m.martins@...cle.com, duanxiongchun@...edance.com,
        fam.zheng@...edance.com, linux-doc@...r.kernel.org,
        linux-kernel@...r.kernel.org, linux-mm@...ck.org,
        linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH v20 8/9] mm: memory_hotplug: disable memmap_on_memory
 when hugetlb_free_vmemmap enabled

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);

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.

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.

Thanks

-- 
Oscar Salvador
SUSE L3

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ