mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-04-18 03:23:53 -04:00
mm: hugetlb: eliminate memory-less nodes handling
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 commit4faf8d950e("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 commit9b5e5d0fdc, 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] Link: https://lkml.kernel.org/r/20220914072603.60293-3-songmuchun@bytedance.com Suggested-by: David Hildenbrand <david@redhat.com> Signed-off-by: Muchun Song <songmuchun@bytedance.com> Acked-by: David Hildenbrand <david@redhat.com> Cc: Andi Kleen <andi@firstfloor.org> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Mike Kravetz <mike.kravetz@oracle.com> Cc: Oscar Salvador <osalvador@suse.de> Cc: Rafael J. Wysocki <rafael@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
committed by
Andrew Morton
parent
b958d4d08f
commit
a4a00b451e
@@ -20,6 +20,7 @@
|
||||
#include <linux/pm_runtime.h>
|
||||
#include <linux/swap.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/hugetlb.h>
|
||||
|
||||
static struct bus_type node_subsys = {
|
||||
.name = "node",
|
||||
@@ -608,10 +609,12 @@ static int register_node(struct node *node, int num)
|
||||
node->dev.groups = node_dev_groups;
|
||||
error = device_register(&node->dev);
|
||||
|
||||
if (error)
|
||||
if (error) {
|
||||
put_device(&node->dev);
|
||||
else
|
||||
} else {
|
||||
hugetlb_register_node(node);
|
||||
compaction_register_node(node);
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
@@ -625,6 +628,7 @@ static int register_node(struct node *node, int num)
|
||||
*/
|
||||
void unregister_node(struct node *node)
|
||||
{
|
||||
hugetlb_unregister_node(node);
|
||||
compaction_unregister_node(node);
|
||||
node_remove_accesses(node);
|
||||
node_remove_caches(node);
|
||||
|
||||
Reference in New Issue
Block a user