Skip to content

Commit 1941b31

Browse files
Christoph Lametertehcaster
authored andcommitted
Reenable NUMA policy support in the slab allocator
Revert commit 8014c46 ("slub: use alloc_pages_node() in alloc_slab_page()"). The patch disabled the numa policy support in the slab allocator. It did not consider that alloc_pages() uses memory policies but alloc_pages_node() does not. As a result of this patch slab memory allocations are no longer spread via interleave policy across all available NUMA nodes on bootup. Instead all slab memory is allocated close to the boot processor. This leads to an imbalance of memory accesses on NUMA systems. Also applications using MPOL_INTERLEAVE as a memory policy will no longer spread slab allocations over all nodes in the interleave set but allocate memory locally. This may also result in unbalanced allocations on a single numa node. SLUB does not apply memory policies to individual object allocations. However, it relies on the page allocators support of memory policies through alloc_pages() to do the NUMA memory allocations on a per folio or page level. SLUB also applies memory policies when retrieving partial allocated slab pages from the partial list. Fixes: 8014c46 ("slub: use alloc_pages_node() in alloc_slab_page()") Signed-off-by: Christoph Lameter <[email protected]> Reviewed-by: Yang Shi <[email protected]> Signed-off-by: Vlastimil Babka <[email protected]>
1 parent bf6b9e9 commit 1941b31

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

mm/slub.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2318,7 +2318,11 @@ static inline struct slab *alloc_slab_page(gfp_t flags, int node,
23182318
struct slab *slab;
23192319
unsigned int order = oo_order(oo);
23202320

2321-
folio = (struct folio *)alloc_pages_node(node, flags, order);
2321+
if (node == NUMA_NO_NODE)
2322+
folio = (struct folio *)alloc_pages(flags, order);
2323+
else
2324+
folio = (struct folio *)__alloc_pages_node(node, flags, order);
2325+
23222326
if (!folio)
23232327
return NULL;
23242328

0 commit comments

Comments
 (0)