]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mm/demotion: fix kernel error with memory hotplug
authorAneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Thu, 25 Aug 2022 09:20:19 +0000 (14:50 +0530)
committerAndrew Morton <akpm@linux-foundation.org>
Fri, 26 Aug 2022 05:03:03 +0000 (22:03 -0700)
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

Link: https://lkml.kernel.org/r/20220825092019.379069-1-aneesh.kumar@linux.ibm.com
Fixes: "mm/demotion: Add hotplug callbacks to handle new numa node onlined"
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Cc: Alistair Popple <apopple@nvidia.com>
Cc: Bharata B Rao <bharata@amd.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Dave Hansen <dave.hansen@intel.com>
Cc: Davidlohr Bueso <dave@stgolabs.net>
Cc: Hesham Almatary <hesham.almatary@huawei.com>
Cc: "Huang, Ying" <ying.huang@intel.com>
Cc: Jagdish Gediya <jvgediya.oss@gmail.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Tim Chen <tim.c.chen@intel.com>
Cc: Wei Xu <weixugc@google.com>
Cc: Yang Shi <shy828301@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/memory-tiers.c

index 05f05395468ac6418db937140ba67d12b92e43a7..f74e077533acaa9f3cde7293c1a8ca0a80a24b37 100644 (file)
@@ -134,7 +134,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);
                        memtype->memtier = NULL;
                        if (list_empty(&memtier->memory_types))
                                destroy_memory_tier(memtier);