From: "Gregory Price (Meta)" A private node carries N_MEMORY without N_MEMORY_COMMON, so the FALLBACK and NOFALLBACK zonelists already exclude it. That leaves no zonelist that can reach it. Add ZONELIST_PRIVATE, which holds a node's local zones only if the node is private. Common nodes have an empty private zonelist. Like the existing zonelists, it is sized for every zone of every node. That adds a zoneref (16 bytes on 64-bit) per possible zone, MAX_NUMNODES * MAX_NR_ZONES, to each pgdat. A smaller local-only zonelist type can be a follow-up if this matters. When the zonelist becomes selectable, __GFP_THISNODE will still suppress OOM, while the page allocator selects the private zonelist instead of NOFALLBACK. If a user grows requiring fallback behavior to COMMON nodes when the private node is out of memory, we can consider adding a fallback variant - but for now private node allocations use a local-only zonelist to limit complexity. Signed-off-by: Gregory Price (Meta) --- include/linux/mmzone.h | 5 +++-- mm/mm_init.c | 5 +++-- mm/page_alloc.c | 2 ++ 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index d6c1a43c0bc8..05f212b56c9d 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -1402,10 +1402,11 @@ enum { ZONELIST_FALLBACK, /* zonelist with fallback */ #ifdef CONFIG_NUMA /* - * The NUMA zonelists are doubled because we need zonelists that - * restrict the allocations to a single node for __GFP_THISNODE. + * NUMA nodes also have local-only zonelists that restrict allocations + * to a single node, for __GFP_THISNODE and for private-node access. */ ZONELIST_NOFALLBACK, /* zonelist without fallback (__GFP_THISNODE) */ + ZONELIST_PRIVATE, /* local private-node access, no fallback */ #endif MAX_ZONELISTS }; diff --git a/mm/mm_init.c b/mm/mm_init.c index 99a45fd04ac5..a6ff49043b5c 100644 --- a/mm/mm_init.c +++ b/mm/mm_init.c @@ -99,7 +99,8 @@ void __init mminit_verify_zonelist(void) /* Print information about the zonelist */ printk(KERN_DEBUG "mminit::zonelist %s %d:%s = ", - listid > 0 ? "thisnode" : "general", nid, + listid == 0 ? "general" : + listid == 1 ? "thisnode" : "private", nid, zone->name); /* Iterate the zonelist */ @@ -2706,7 +2707,7 @@ void __init mm_core_init(void) init_zero_page_pfn(); /* Initializations relying on SMP setup */ - BUILD_BUG_ON(MAX_ZONELISTS > 2); + BUILD_BUG_ON(MAX_ZONELISTS > 3); build_all_zonelists(NULL); page_alloc_init_cpuhp(); alloc_tag_sec_init(); diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 08e57f809a03..0bd21916cea1 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -6010,6 +6010,8 @@ static void build_zonelists(pg_data_t *pgdat) ZONELIST_FALLBACK); build_local_zonelist(pgdat, ZONELIST_NOFALLBACK, node_state(nid, N_MEMORY_COMMON)); + build_local_zonelist(pgdat, ZONELIST_PRIVATE, + node_state(nid, N_MEMORY_PRIVATE)); } #ifdef CONFIG_HAVE_MEMORYLESS_NODES -- 2.56.1