linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/demotion: Fix kernel error with memory hotplug
@ 2022-08-25  9:20 Aneesh Kumar K.V
  2022-08-25 12:16 ` David Hildenbrand
  0 siblings, 1 reply; 6+ messages in thread
From: Aneesh Kumar K.V @ 2022-08-25  9:20 UTC (permalink / raw)
  To: linux-mm, akpm
  Cc: Wei Xu, Huang Ying, Yang Shi, Davidlohr Bueso, Tim C Chen,
	Michal Hocko, Linux Kernel Mailing List, Hesham Almatary,
	Dave Hansen, Jonathan Cameron, Alistair Popple, Dan Williams,
	Johannes Weiner, jvgediya.oss, Bharata B Rao, 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
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
---
 mm/memory-tiers.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/memory-tiers.c b/mm/memory-tiers.c
index a20795bb0e07..ba844fe9cc8c 100644
--- a/mm/memory-tiers.c
+++ b/mm/memory-tiers.c
@@ -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);
 		}
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-08-26  9:54 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-25  9:20 [PATCH] mm/demotion: Fix kernel error with memory hotplug Aneesh Kumar K.V
2022-08-25 12:16 ` David Hildenbrand
2022-08-25 12:53   ` Aneesh Kumar K V
2022-08-26  0:25     ` Huang, Ying
2022-08-26  3:04       ` Andrew Morton
2022-08-26  9:53     ` David Hildenbrand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).