]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
mm,mempolicy: use node-notifier instead of memory-notifier
authorOscar Salvador <osalvador@suse.de>
Mon, 16 Jun 2025 13:51:52 +0000 (15:51 +0200)
committerAndrew Morton <akpm@linux-foundation.org>
Sun, 13 Jul 2025 23:38:16 +0000 (16:38 -0700)
mempolicy is only concerned when a numa node changes its memory state,
because it needs to take this node into account for the auto-weighted
memory policy system.  So stop using the memory notifier and use the new
numa node notifer instead.

Link: https://lkml.kernel.org/r/20250616135158.450136-10-osalvador@suse.de
Signed-off-by: Oscar Salvador <osalvador@suse.de>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Harry Yoo <harry.yoo@oracle.com>
Reviewed-by: Vlastimil Babka <vbabka@suse.cz>
Reviewed-by: Rakie Kim <rakie.kim@sk.com>
Acked-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Gregory Price <gourry@gourry.net>
Cc: Hyeonggon Yoo <42.hyeyoo@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/mempolicy.c

index b0619d0020c93af7b240c8170a636cd3871fdd00..1ff7b2174eb77866591633ec87c7577d1923cb5e 100644 (file)
@@ -3788,20 +3788,17 @@ static int wi_node_notifier(struct notifier_block *nb,
                               unsigned long action, void *data)
 {
        int err;
-       struct memory_notify *arg = data;
-       int nid = arg->status_change_nid;
-
-       if (nid < 0)
-               return NOTIFY_OK;
+       struct node_notify *nn = data;
+       int nid = nn->nid;
 
        switch (action) {
-       case MEM_ONLINE:
+       case NODE_ADDED_FIRST_MEMORY:
                err = sysfs_wi_node_add(nid);
                if (err)
                        pr_err("failed to add sysfs for node%d during hotplug: %d\n",
                               nid, err);
                break;
-       case MEM_OFFLINE:
+       case NODE_REMOVED_LAST_MEMORY:
                sysfs_wi_node_delete(nid);
                break;
        }
@@ -3840,7 +3837,7 @@ static int __init add_weighted_interleave_group(struct kobject *mempolicy_kobj)
                }
        }
 
-       hotplug_memory_notifier(wi_node_notifier, DEFAULT_CALLBACK_PRI);
+       hotplug_node_notifier(wi_node_notifier, DEFAULT_CALLBACK_PRI);
        return 0;
 
 err_cleanup_kobj: