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: <b8d2fe17-93e6-743a-73c4-e8b22964704b@redhat.com>
Date:   Thu, 8 Sep 2022 14:21:34 +0200
From:   David Hildenbrand <david@...hat.com>
To:     Muchun Song <songmuchun@...edance.com>, gregkh@...uxfoundation.org,
        rafael@...nel.org, mike.kravetz@...cle.com,
        akpm@...ux-foundation.org, osalvador@...e.de, ying.huang@...el.com,
        aneesh.kumar@...ux.ibm.com, rientjes@...gle.com
Cc:     linux-kernel@...r.kernel.org, linux-mm@...ck.org,
        muchun.song@...ux.dev
Subject: Re: [PATCH v3] mm: hugetlb: eliminate memory-less nodes handling

On 08.09.22 09:58, Muchun Song wrote:
> The memory-notify-based approach aims to handle meory-less nodes, however, it just adds
> the complexity of code as pointed by David in thread [1].  The handling of memory-less
> nodes is introduced by commit 4faf8d950ec4 ("hugetlb: handle memory hot-plug events").
>  From its commit message, we cannot find any necessity of handling this case. So, we can
> simply register/unregister sysfs entries in register_node/unregister_node to simlify the
> code.
> 
> BTW, hotplug callback added because in hugetlb_register_all_nodes() we register sysfs
> nodes only for N_MEMORY nodes, seeing commit 9b5e5d0fdc91, which said it was a preparation
> for handling memory-less nodes via memory hotplug. Since we want to remove memory hotplug,
> so make sure we only register per-node sysfs for online (N_ONLINE) nodes in
> hugetlb_register_all_nodes().
> 
> https://lore.kernel.org/linux-mm/60933ffc-b850-976c-78a0-0ee6e0ea9ef0@redhat.com/ [1]
> Suggested-by: David Hildenbrand <david@...hat.com>
> Signed-off-by: Muchun Song <songmuchun@...edance.com>
> ---
> v3:
>   - Fix 'struct node' is not declared reported by LTP.
> 
> v2:
>   - Move declaration of function related to hugetlb to hugetlb.h (David).
>   - Introduce hugetlb_sysfs_initialized() and call it from hugetlb_sysfs_init() (David).
>   - Move hugetlb_register_all_nodes() into hugetlb_sysfs_init() (David).
>   - Fix implicit-function-declaration reported by LKP.
>   - Register per-node sysfs for online (N_ONLINE) nodes instead of N_MEMORY (Aneesh).
> 
>   drivers/base/node.c     |  8 +++--
>   include/linux/hugetlb.h | 14 +++++++++
>   mm/hugetlb.c            | 81 ++++++++++++++++++++++---------------------------
>   3 files changed, 57 insertions(+), 46 deletions(-)



> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -3880,24 +3880,14 @@ static int hugetlb_sysfs_add_hstate(struct hstate *h, struct kobject *parent,
>   	return 0;
>   }
>   
> -static void __init hugetlb_sysfs_init(void)
> -{
> -	struct hstate *h;
> -	int err;
> -
> -	hugepages_kobj = kobject_create_and_add("hugepages", mm_kobj);
> -	if (!hugepages_kobj)
> -		return;
> +#ifdef CONFIG_NUMA
> +static bool hugetlb_sysfs_initialized __ro_after_init;
>   
> -	for_each_hstate(h) {
> -		err = hugetlb_sysfs_add_hstate(h, hugepages_kobj,
> -					 hstate_kobjs, &hstate_attr_group);
> -		if (err)
> -			pr_err("HugeTLB: Unable to add hstate %s", h->name);
> -	}
> +static inline void hugetlb_mark_sysfs_initialized(void)
> +{
> +	hugetlb_sysfs_initialized = true;
>   }

Do we really need a separate function for this? Why not simply always 
set that from hugetlb_sysfs_init() ?

I'm also not sure if we really want to optimize out one variable for 
!CONFIG_NUMA.



Anyhow, in general

Acked-by: David Hildenbrand <david@...hat.com>


-- 
Thanks,

David / dhildenb

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ