diff options
| author | Hao Li <hao.li@linux.dev> | 2026-04-03 15:37:36 +0800 |
|---|---|---|
| committer | Vlastimil Babka (SUSE) <vbabka@kernel.org> | 2026-04-07 11:10:52 +0200 |
| commit | 7f9bb84fdb5ee7621fcd6519cd14d3dc9aa75c5c (patch) | |
| tree | c72aeaf21360cf26583683e5f176691c773efc4b /mm | |
| parent | e65d430111a5ba83598b03a4aca4799eb295eef1 (diff) | |
| download | lwn-7f9bb84fdb5ee7621fcd6519cd14d3dc9aa75c5c.tar.gz lwn-7f9bb84fdb5ee7621fcd6519cd14d3dc9aa75c5c.zip | |
slub: use N_NORMAL_MEMORY in can_free_to_pcs to handle remote frees
Memory hotplug now keeps N_NORMAL_MEMORY up to date correctly, so make
can_free_to_pcs() use it.
As a result, when freeing objects on memoryless nodes, or on nodes that
have memory but only in ZONE_MOVABLE, the objects can be freed to the
sheaf instead of going through the slow path.
Signed-off-by: Hao Li <hao.li@linux.dev>
Acked-by: Harry Yoo (Oracle) <harry@kernel.org>
Acked-by: David Rientjes <rientjes@google.com>
Link: https://patch.msgid.link/20260403073958.8722-1-hao.li@linux.dev
Signed-off-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
Diffstat (limited to 'mm')
| -rw-r--r-- | mm/slub.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/mm/slub.c b/mm/slub.c index 492ef5927e58..f896cdb41383 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -6022,14 +6022,15 @@ static __always_inline bool can_free_to_pcs(struct slab *slab) goto check_pfmemalloc; /* - * Freed object isn't from this cpu's node, but that node is memoryless. + * Freed object isn't from this cpu's node, but that node is memoryless + * or only has ZONE_MOVABLE memory, which slab cannot allocate from. * Proceed as it's better to cache remote objects than falling back to * the slowpath for everything. The allocation side can never obtain * a local object anyway, if none exist. We don't have numa_mem_id() to * point to the closest node as we would on a proper memoryless node * setup. */ - if (unlikely(!node_state(numa_node, N_MEMORY))) + if (unlikely(!node_state(numa_node, N_NORMAL_MEMORY))) goto check_pfmemalloc; #endif |
