Skip to content

Commit e2d18cb

Browse files
committed
mm, slab: restore NUMA policy support for large kmalloc
The slab allocator observes the task's NUMA policy in various places such as allocating slab pages. Large kmalloc() allocations used to do that too, until an unintended change by c4cab55 ("mm/slab_common: cleanup kmalloc_large()") resulted in ignoring mempolicy and just preferring the local node. Restore the NUMA policy support. Fixes: c4cab55 ("mm/slab_common: cleanup kmalloc_large()") Cc: <[email protected]> Acked-by: Christoph Lameter (Ampere) <[email protected]> Acked-by: Roman Gushchin <[email protected]> Reviewed-by: Harry Yoo <[email protected]> Signed-off-by: Vlastimil Babka <[email protected]>
1 parent e04c78d commit e2d18cb

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

mm/slub.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4269,7 +4269,12 @@ static void *___kmalloc_large_node(size_t size, gfp_t flags, int node)
42694269
flags = kmalloc_fix_flags(flags);
42704270

42714271
flags |= __GFP_COMP;
4272-
folio = (struct folio *)alloc_pages_node_noprof(node, flags, order);
4272+
4273+
if (node == NUMA_NO_NODE)
4274+
folio = (struct folio *)alloc_pages_noprof(flags, order);
4275+
else
4276+
folio = (struct folio *)__alloc_pages_noprof(flags, order, node, NULL);
4277+
42734278
if (folio) {
42744279
ptr = folio_address(folio);
42754280
lruvec_stat_mod_folio(folio, NR_SLAB_UNRECLAIMABLE_B,

0 commit comments

Comments
 (0)