mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-04 20:19:47 +08:00
mm,memory-tiers: use node-notifier instead of memory-notifier
memory-tier is only concerned when a numa node changes its memory state, because it then needs to re-create the demotion list. So stop using the memory notifier and use the new numa node notifer instead. Link: https://lkml.kernel.org/r/20250616135158.450136-6-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> Acked-by: David Hildenbrand <david@redhat.com> Cc: Hyeonggon Yoo <42.hyeyoo@gmail.com> Cc: Rakie Kim <rakie.kim@sk.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
parent
5a20c096a1
commit
265ab08697
@ -872,25 +872,18 @@ static int __meminit memtier_hotplug_callback(struct notifier_block *self,
|
|||||||
unsigned long action, void *_arg)
|
unsigned long action, void *_arg)
|
||||||
{
|
{
|
||||||
struct memory_tier *memtier;
|
struct memory_tier *memtier;
|
||||||
struct memory_notify *arg = _arg;
|
struct node_notify *nn = _arg;
|
||||||
|
|
||||||
/*
|
|
||||||
* Only update the node migration order when a node is
|
|
||||||
* changing status, like online->offline.
|
|
||||||
*/
|
|
||||||
if (arg->status_change_nid < 0)
|
|
||||||
return notifier_from_errno(0);
|
|
||||||
|
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case MEM_OFFLINE:
|
case NODE_REMOVED_LAST_MEMORY:
|
||||||
mutex_lock(&memory_tier_lock);
|
mutex_lock(&memory_tier_lock);
|
||||||
if (clear_node_memory_tier(arg->status_change_nid))
|
if (clear_node_memory_tier(nn->nid))
|
||||||
establish_demotion_targets();
|
establish_demotion_targets();
|
||||||
mutex_unlock(&memory_tier_lock);
|
mutex_unlock(&memory_tier_lock);
|
||||||
break;
|
break;
|
||||||
case MEM_ONLINE:
|
case NODE_ADDED_FIRST_MEMORY:
|
||||||
mutex_lock(&memory_tier_lock);
|
mutex_lock(&memory_tier_lock);
|
||||||
memtier = set_node_memory_tier(arg->status_change_nid);
|
memtier = set_node_memory_tier(nn->nid);
|
||||||
if (!IS_ERR(memtier))
|
if (!IS_ERR(memtier))
|
||||||
establish_demotion_targets();
|
establish_demotion_targets();
|
||||||
mutex_unlock(&memory_tier_lock);
|
mutex_unlock(&memory_tier_lock);
|
||||||
@ -929,7 +922,7 @@ static int __init memory_tier_init(void)
|
|||||||
nodes_and(default_dram_nodes, node_states[N_MEMORY],
|
nodes_and(default_dram_nodes, node_states[N_MEMORY],
|
||||||
node_states[N_CPU]);
|
node_states[N_CPU]);
|
||||||
|
|
||||||
hotplug_memory_notifier(memtier_hotplug_callback, MEMTIER_HOTPLUG_PRI);
|
hotplug_node_notifier(memtier_hotplug_callback, MEMTIER_HOTPLUG_PRI);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
subsys_initcall(memory_tier_init);
|
subsys_initcall(memory_tier_init);
|
||||||
|
Loading…
Reference in New Issue
Block a user