hashdist currently always uses vmalloc when hashdist is true. When
there is only 1 online node and size <= MAX_ORDER, vmalloc can be
avoided.

Signed-off-by: Nicholas Piggin <npig...@gmail.com>
---
 mm/page_alloc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 1683d54d6405..1312d4db5602 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -7978,7 +7978,8 @@ void *__init alloc_large_system_hash(const char 
*tablename,
                        else
                                table = memblock_alloc_raw(size,
                                                           SMP_CACHE_BYTES);
-               } else if (get_order(size) >= MAX_ORDER || hashdist) {
+               } else if (get_order(size) >= MAX_ORDER ||
+                               (hashdist && num_online_nodes() > 1)) {
                        table = __vmalloc(size, gfp_flags, PAGE_KERNEL);
                } else {
                        /*
-- 
2.20.1

Reply via email to