Skip to content

Commit a561ce0

Browse files
JoonsooKimtorvalds
authored andcommitted
slub: fall back to node_to_mem_node() node if allocating on memoryless node
Update the SLUB code to search for partial slabs on the nearest node with memory in the presence of memoryless nodes. Additionally, do not consider it to be an ALLOC_NODE_MISMATCH (and deactivate the slab) when a memoryless-node specified allocation goes off-node. Signed-off-by: Joonsoo Kim <[email protected]> Signed-off-by: Nishanth Aravamudan <[email protected]> Cc: David Rientjes <[email protected]> Cc: Han Pingtian <[email protected]> Cc: Pekka Enberg <[email protected]> Cc: Paul Mackerras <[email protected]> Cc: Benjamin Herrenschmidt <[email protected]> Cc: Michael Ellerman <[email protected]> Cc: Anton Blanchard <[email protected]> Cc: Christoph Lameter <[email protected]> Cc: Wanpeng Li <[email protected]> Cc: Tejun Heo <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent ad2c814 commit a561ce0

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

mm/slub.c

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1699,7 +1699,12 @@ static void *get_partial(struct kmem_cache *s, gfp_t flags, int node,
16991699
struct kmem_cache_cpu *c)
17001700
{
17011701
void *object;
1702-
int searchnode = (node == NUMA_NO_NODE) ? numa_mem_id() : node;
1702+
int searchnode = node;
1703+
1704+
if (node == NUMA_NO_NODE)
1705+
searchnode = numa_mem_id();
1706+
else if (!node_present_pages(node))
1707+
searchnode = node_to_mem_node(node);
17031708

17041709
object = get_partial_node(s, get_node(s, searchnode), c, flags);
17051710
if (object || node != NUMA_NO_NODE)
@@ -2280,11 +2285,18 @@ static void *__slab_alloc(struct kmem_cache *s, gfp_t gfpflags, int node,
22802285
redo:
22812286

22822287
if (unlikely(!node_match(page, node))) {
2283-
stat(s, ALLOC_NODE_MISMATCH);
2284-
deactivate_slab(s, page, c->freelist);
2285-
c->page = NULL;
2286-
c->freelist = NULL;
2287-
goto new_slab;
2288+
int searchnode = node;
2289+
2290+
if (node != NUMA_NO_NODE && !node_present_pages(node))
2291+
searchnode = node_to_mem_node(node);
2292+
2293+
if (unlikely(!node_match(page, searchnode))) {
2294+
stat(s, ALLOC_NODE_MISMATCH);
2295+
deactivate_slab(s, page, c->freelist);
2296+
c->page = NULL;
2297+
c->freelist = NULL;
2298+
goto new_slab;
2299+
}
22882300
}
22892301

22902302
/*

0 commit comments

Comments
 (0)