This is another approach of building zonelist based on patch #10 of patchset[1]. For systems with heterogeneous DRAM and PMEM (persistent memory), 1) change ZONELIST_FALLBACK to first fallback to same type nodes, then the other types 2) add ZONELIST_FALLBACK_SAME_TYPE to fallback only same type nodes. To be explicitly selected by __GFP_SAME_NODE_TYPE. For example, a 2S DRAM+PMEM system may have NUMA distances: node 0 1 2 3 0: 10 21 17 28 1: 21 10 28 17 2: 17 28 10 28 3: 28 17 28 10 Node 0,1 are DRAM nodes, node 2, 3 are PMEM nodes. ZONELIST_FALLBACK ================= Current zoned fallback lists are based on numa distance only, which means page allocation request from node 0 will iterate zone order like: DRAM node 0 -> PMEM node 2 -> DRAM node 1 -> PMEM node 3. However PMEM has different characteristics from DRAM, the more reasonable or desirable fallback style would be: DRAM node 0 -> DRAM node 1 -> PMEM node 2 -> PMEM node 3. When DRAM is exhausted, try PMEM then. ZONELIST_FALLBACK_SAME_TYPE =========================== Some cases are more suitable to fit PMEM characteristics, like page is read more frequently than written. Other cases may prefer DRAM only. It doesn't matter page is from local node, or remote. Create __GFP_SAME_NODE_TYPE to request page of same node type, either we got DRAM(from node 0, 1) or PMEM (from node 2, 3), it's kind of extension to the nofallback list, but with the same node type. This patchset is self-contained, and based on Linux 5.1-rc6. [1]: https://lkml.org/lkml/2018/12/26/138 Fan Du (5): acpi/numa: memorize NUMA node type from SRAT table mmzone: new pgdat flags for DRAM and PMEM x86,numa: update numa node type mm, page alloc: build fallback list on per node type basis mm, page_alloc: Introduce ZONELIST_FALLBACK_SAME_TYPE fallback list arch/x86/include/asm/numa.h | 2 ++ arch/x86/mm/numa.c | 3 +++ drivers/acpi/numa.c | 5 ++++ include/linux/gfp.h | 7 ++++++ include/linux/mmzone.h | 35 ++++++++++++++++++++++++++++ mm/page_alloc.c | 57 ++++++++++++++++++++++++++++++++------------- 6 files changed, 93 insertions(+), 16 deletions(-) -- 1.8.3.1