Skip to contentSkip to conversation

mm/demotion: Fix kernel error with memory hotplug

PATCH In review Aneesh Kumar K.V 4 participants 6 messages Aug 25, 2022 – Aug 26, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mm/demotion: Fix kernel error with memory hotplug

On memory hot unplug, the kernel removes the node memory type from the associated memory tier. Use list_del_init instead of list del such that the same memory type can be added back to a memory tier on hotplug.

Without this, we get the below warning and return error on adding memory type to a new memory tier.

[   33.596095] ------------[ cut here ]------------
[   33.596099] WARNING: CPU: 3 PID: 667 at mm/memory-tiers.c:115 set_node_memory_tier+0xd6/0x2e0
[   33.596109] Modules linked in: kmem

...

[   33.596126] RIP: 0010:set_node_memory_tier+0xd6/0x2e0

....

[   33.596196]  memtier_hotplug_callback+0x48/0x68
[   33.596204]  blocking_notifier_call_chain+0x80/0xc0
[   33.596211]  online_pages+0x25e/0x280
[   33.596218]  memory_block_change_state+0x176/0x1f0
[   33.596225]  memory_subsys_online+0x37/0x40
[   33.596230]  online_store+0x9b/0x130
[   33.596236]  kernfs_fop_write_iter+0x128/0x1b0
[   33.596242]  vfs_write+0x24b/0x2c0
[   33.596249]  ksys_write+0x74/0xe0
[   33.596254]  do_syscall_64+0x43/0x90
[   33.596259]  entry_SYSCALL_64_after_hwframe+0x63/0xcd
Fixes mm/demotion: Add hotplug callbacks to handle new numa node onlined
---
 mm/memory-tiers.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/memory-tiers.c +1 -1
index a20795bb0e07..ba844fe9cc8c 100644
@@ -451,7 +451,7 @@ static bool clear_node_memory_tier(int node)
 		memtype = node_memory_types[node];
 		node_clear(node, memtype->nodes);
 		if (nodes_empty(memtype->nodes)) {
-			list_del(&memtype->tier_sibiling);
+			list_del_init(&memtype->tier_sibiling);
 			if (list_empty(&memtier->memory_types))
 				destroy_memory_tier(memtier);
 		}
Signature · 1 line
2.37.2
#1 lore raw
Quoted 29 lines · Aneesh Kumar K.V

On memory hot unplug, the kernel removes the node memory type from the associated memory tier. Use list_del_init instead of list del such that the same memory type can be added back to a memory tier on hotplug.

Without this, we get the below warning and return error on adding memory type to a new memory tier.

[   33.596095] ------------[ cut here ]------------
[   33.596099] WARNING: CPU: 3 PID: 667 at mm/memory-tiers.c:115 set_node_memory_tier+0xd6/0x2e0
[   33.596109] Modules linked in: kmem

...

[   33.596126] RIP: 0010:set_node_memory_tier+0xd6/0x2e0

....

[   33.596196]  memtier_hotplug_callback+0x48/0x68
[   33.596204]  blocking_notifier_call_chain+0x80/0xc0
[   33.596211]  online_pages+0x25e/0x280
[   33.596218]  memory_block_change_state+0x176/0x1f0
[   33.596225]  memory_subsys_online+0x37/0x40
[   33.596230]  online_store+0x9b/0x130
[   33.596236]  kernfs_fop_write_iter+0x128/0x1b0
[   33.596242]  vfs_write+0x24b/0x2c0
[   33.596249]  ksys_write+0x74/0xe0
[   33.596254]  do_syscall_64+0x43/0x90
[   33.596259]  entry_SYSCALL_64_after_hwframe+0x63/0xcd
Quoted 1 line
Fixes mm/demotion: Add hotplug callbacks to handle new numa node onlined

Do we have a proper 12-digit commit id as well?

Do we have to cc stable?

Quoted 18 lines
---
 mm/memory-tiers.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/memory-tiers.c +1 -1
index a20795bb0e07..ba844fe9cc8c 100644
@@ -451,7 +451,7 @@ static bool clear_node_memory_tier(int node)
 		memtype = node_memory_types[node];
 		node_clear(node, memtype->nodes);
 		if (nodes_empty(memtype->nodes)) {
-			list_del(&memtype->tier_sibiling);
+			list_del_init(&memtype->tier_sibiling);
 			if (list_empty(&memtier->memory_types))
 				destroy_memory_tier(memtier);
 		}
Signature · 3 lines
Thanks,

David / dhildenb
#2 lore raw
Quoted 30 lines · David Hildenbrand
Quoted 29 lines · Aneesh Kumar K.V

On memory hot unplug, the kernel removes the node memory type from the associated memory tier. Use list_del_init instead of list del such that the same memory type can be added back to a memory tier on hotplug.

Without this, we get the below warning and return error on adding memory type to a new memory tier.

[   33.596095] ------------[ cut here ]------------
[   33.596099] WARNING: CPU: 3 PID: 667 at mm/memory-tiers.c:115 set_node_memory_tier+0xd6/0x2e0
[   33.596109] Modules linked in: kmem

...

[   33.596126] RIP: 0010:set_node_memory_tier+0xd6/0x2e0

....

[   33.596196]  memtier_hotplug_callback+0x48/0x68
[   33.596204]  blocking_notifier_call_chain+0x80/0xc0
[   33.596211]  online_pages+0x25e/0x280
[   33.596218]  memory_block_change_state+0x176/0x1f0
[   33.596225]  memory_subsys_online+0x37/0x40
[   33.596230]  online_store+0x9b/0x130
[   33.596236]  kernfs_fop_write_iter+0x128/0x1b0
[   33.596242]  vfs_write+0x24b/0x2c0
[   33.596249]  ksys_write+0x74/0xe0
[   33.596254]  do_syscall_64+0x43/0x90
[   33.596259]  entry_SYSCALL_64_after_hwframe+0x63/0xcd
Quoted 6 lines
Quoted 1 line
Fixes mm/demotion: Add hotplug callbacks to handle new numa node onlined

Do we have a proper 12-digit commit id as well?

Do we have to cc stable?

That patch is not yet merged upstream. It is in mm-unstable. I guess Andrew can fold the change into the original patch?

-aneesh

#3 lore raw
Quoted 33 lines · Aneesh Kumar K V
Quoted 32 lines · David Hildenbrand
Quoted 30 lines · Aneesh Kumar K.V

On memory hot unplug, the kernel removes the node memory type from the associated memory tier. Use list_del_init instead of list del such that the same memory type can be added back to a memory tier on hotplug.

Without this, we get the below warning and return error on adding memory type to a new memory tier.

[   33.596095] ------------[ cut here ]------------
[   33.596099] WARNING: CPU: 3 PID: 667 at mm/memory-tiers.c:115 set_node_memory_tier+0xd6/0x2e0
[   33.596109] Modules linked in: kmem

...

[   33.596126] RIP: 0010:set_node_memory_tier+0xd6/0x2e0

....

[   33.596196]  memtier_hotplug_callback+0x48/0x68
[   33.596204]  blocking_notifier_call_chain+0x80/0xc0
[   33.596211]  online_pages+0x25e/0x280
[   33.596218]  memory_block_change_state+0x176/0x1f0
[   33.596225]  memory_subsys_online+0x37/0x40
[   33.596230]  online_store+0x9b/0x130
[   33.596236]  kernfs_fop_write_iter+0x128/0x1b0
[   33.596242]  vfs_write+0x24b/0x2c0
[   33.596249]  ksys_write+0x74/0xe0
[   33.596254]  do_syscall_64+0x43/0x90
[   33.596259]  entry_SYSCALL_64_after_hwframe+0x63/0xcd
Fixes mm/demotion: Add hotplug callbacks to handle new numa node onlined
Quoted 7 lines
Quoted 4 lines

Do we have a proper 12-digit commit id as well?

Do we have to cc stable?

That patch is not yet merged upstream. It is in mm-unstable. I guess Andrew can fold the change into the original patch?

I think it may better to reply the original patch and name this patch as fix, for example,

mm/demotion: Add hotplug callbacks to handle new numa node onlined fix

I found Andrew uses this kind of name before for fixing.

Best Regards,
Huang, Ying

maintainer
#4 lore raw
Quoted 6 lines · Ying
Quoted 5 lines
Quoted 2 lines

Do we have to cc stable?

That patch is not yet merged upstream. It is in mm-unstable. I guess Andrew can fold the change into the original patch?

Quoted 6 lines

I think it may better to reply the original patch and name this patch as fix, for example,

mm/demotion: Add hotplug callbacks to handle new numa node onlined fix

I found Andrew uses this kind of name before for fixing.

Doesn't matter much - figuring out which-patch-did-this-patch-fix is, shall we say, a common operation at akpm headquarters ;)

This was an easy one, thanks to the Fixes:. The patch didn't actually apply at the desired point in the series, and that's pretty common. All fixed up now, thanks.

#5 lore raw
In reply to Aneesh Kumar K V
Quoted 33 lines · Aneesh Kumar K V
Quoted 32 lines · David Hildenbrand
Quoted 30 lines · Aneesh Kumar K.V

On memory hot unplug, the kernel removes the node memory type from the associated memory tier. Use list_del_init instead of list del such that the same memory type can be added back to a memory tier on hotplug.

Without this, we get the below warning and return error on adding memory type to a new memory tier.

[   33.596095] ------------[ cut here ]------------
[   33.596099] WARNING: CPU: 3 PID: 667 at mm/memory-tiers.c:115 set_node_memory_tier+0xd6/0x2e0
[   33.596109] Modules linked in: kmem

...

[   33.596126] RIP: 0010:set_node_memory_tier+0xd6/0x2e0

....

[   33.596196]  memtier_hotplug_callback+0x48/0x68
[   33.596204]  blocking_notifier_call_chain+0x80/0xc0
[   33.596211]  online_pages+0x25e/0x280
[   33.596218]  memory_block_change_state+0x176/0x1f0
[   33.596225]  memory_subsys_online+0x37/0x40
[   33.596230]  online_store+0x9b/0x130
[   33.596236]  kernfs_fop_write_iter+0x128/0x1b0
[   33.596242]  vfs_write+0x24b/0x2c0
[   33.596249]  ksys_write+0x74/0xe0
[   33.596254]  do_syscall_64+0x43/0x90
[   33.596259]  entry_SYSCALL_64_after_hwframe+0x63/0xcd
Fixes mm/demotion: Add hotplug callbacks to handle new numa node onlined
Quoted 8 lines
Quoted 4 lines

Do we have a proper 12-digit commit id as well?

Do we have to cc stable?

That patch is not yet merged upstream. It is in mm-unstable. I guess Andrew can fold the change into the original patch?

Please make that clearer next time somehow -- either via "[PATCH mm-unstable]" or just by stating "Andrew, please squash this into XYZ".

I know, akpm headquarter tracks all pending patches, but for other reviewers this really helps to figure out how urgent this is and where this applies to (+ saves time).

Signature · 3 lines
Thanks,

David / dhildenb