1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 2 #ifndef _LINUX_MEMBLOCK_H 3 #define _LINUX_MEMBLOCK_H 4 #ifdef __KERNEL__ 5 6 /* 7 * Logical memory blocks. 8 * 9 * Copyright (C) 2001 Peter Bergner, IBM Corp. 10 */ 11 12 #include <linux/init.h> 13 #include <linux/mm.h> 14 #include <asm/dma.h> 15 16 extern unsigned long max_low_pfn; 17 extern unsigned long min_low_pfn; 18 19 /* 20 * highest page 21 */ 22 extern unsigned long max_pfn; 23 /* 24 * highest possible page 25 */ 26 extern unsigned long long max_possible_pfn; 27 28 /** 29 * enum memblock_flags - definition of memory region attributes 30 * @MEMBLOCK_NONE: no special request 31 * @MEMBLOCK_HOTPLUG: memory region indicated in the firmware-provided memory 32 * map during early boot as hot(un)pluggable system RAM (e.g., memory range 33 * that might get hotunplugged later). With "movable_node" set on the kernel 34 * commandline, try keeping this memory region hotunpluggable. Does not apply 35 * to memblocks added ("hotplugged") after early boot. 36 * @MEMBLOCK_MIRROR: mirrored region 37 * @MEMBLOCK_NOMAP: don't add to kernel direct mapping and treat as 38 * reserved in the memory map; refer to memblock_mark_nomap() description 39 * for further details 40 */ 41 enum memblock_flags { 42 MEMBLOCK_NONE = 0x0, /* No special request */ 43 MEMBLOCK_HOTPLUG = 0x1, /* hotpluggable region */ 44 MEMBLOCK_MIRROR = 0x2, /* mirrored region */ 45 MEMBLOCK_NOMAP = 0x4, /* don't add to kernel direct mapping */ 46 }; 47 48 /** 49 * struct memblock_region - represents a memory region 50 * @base: base address of the region 51 * @size: size of the region 52 * @flags: memory region attributes 53 * @nid: NUMA node id 54 */ 55 struct memblock_region { 56 phys_addr_t base; 57 phys_addr_t size; 58 enum memblock_flags flags; 59 #ifdef CONFIG_NUMA 60 int nid; 61 #endif 62 }; 63 64 /** 65 * struct memblock_type - collection of memory regions of certain type 66 * @cnt: number of regions 67 * @max: size of the allocated array 68 * @total_size: size of all regions 69 * @regions: array of regions 70 * @name: the memory type symbolic name 71 */ 72 struct memblock_type { 73 unsigned long cnt; 74 unsigned long max; 75 phys_addr_t total_size; 76 struct memblock_region *regions; 77 char *name; 78 }; 79 80 /** 81 * struct memblock - memblock allocator metadata 82 * @bottom_up: is bottom up direction? 83 * @current_limit: physical address of the current allocation limit 84 * @memory: usable memory regions 85 * @reserved: reserved memory regions 86 */ 87 struct memblock { 88 bool bottom_up; /* is bottom up direction? */ 89 phys_addr_t current_limit; 90 struct memblock_type memory; 91 struct memblock_type reserved; 92 }; 93 94 extern struct memblock memblock; 95 96 #ifndef CONFIG_ARCH_KEEP_MEMBLOCK 97 #define __init_memblock __meminit 98 #define __initdata_memblock __meminitdata 99 void memblock_discard(void); 100 #else 101 #define __init_memblock 102 #define __initdata_memblock 103 static inline void memblock_discard(void) {} 104 #endif 105 106 void memblock_allow_resize(void); 107 int memblock_add_node(phys_addr_t base, phys_addr_t size, int nid, 108 enum memblock_flags flags); 109 int memblock_add(phys_addr_t base, phys_addr_t size); 110 int memblock_remove(phys_addr_t base, phys_addr_t size); 111 int memblock_phys_free(phys_addr_t base, phys_addr_t size); 112 int memblock_reserve(phys_addr_t base, phys_addr_t size); 113 #ifdef CONFIG_HAVE_MEMBLOCK_PHYS_MAP 114 int memblock_physmem_add(phys_addr_t base, phys_addr_t size); 115 #endif 116 void memblock_trim_memory(phys_addr_t align); 117 bool memblock_overlaps_region(struct memblock_type *type, 118 phys_addr_t base, phys_addr_t size); 119 int memblock_mark_hotplug(phys_addr_t base, phys_addr_t size); 120 int memblock_clear_hotplug(phys_addr_t base, phys_addr_t size); 121 int memblock_mark_mirror(phys_addr_t base, phys_addr_t size); 122 int memblock_mark_nomap(phys_addr_t base, phys_addr_t size); 123 int memblock_clear_nomap(phys_addr_t base, phys_addr_t size); 124 125 void memblock_free_all(void); 126 void memblock_free(void *ptr, size_t size); 127 void reset_node_managed_pages(pg_data_t *pgdat); 128 void reset_all_zones_managed_pages(void); 129 130 /* Low level functions */ 131 void __next_mem_range(u64 *idx, int nid, enum memblock_flags flags, 132 struct memblock_type *type_a, 133 struct memblock_type *type_b, phys_addr_t *out_start, 134 phys_addr_t *out_end, int *out_nid); 135 136 void __next_mem_range_rev(u64 *idx, int nid, enum memblock_flags flags, 137 struct memblock_type *type_a, 138 struct memblock_type *type_b, phys_addr_t *out_start, 139 phys_addr_t *out_end, int *out_nid); 140 141 void memblock_free_late(phys_addr_t base, phys_addr_t size); 142 143 #ifdef CONFIG_HAVE_MEMBLOCK_PHYS_MAP 144 static inline void __next_physmem_range(u64 *idx, struct memblock_type *type, 145 phys_addr_t *out_start, 146 phys_addr_t *out_end) 147 { 148 extern struct memblock_type physmem; 149 150 __next_mem_range(idx, NUMA_NO_NODE, MEMBLOCK_NONE, &physmem, type, 151 out_start, out_end, NULL); 152 } 153 154 /** 155 * for_each_physmem_range - iterate through physmem areas not included in type. 156 * @i: u64 used as loop variable 157 * @type: ptr to memblock_type which excludes from the iteration, can be %NULL 158 * @p_start: ptr to phys_addr_t for start address of the range, can be %NULL 159 * @p_end: ptr to phys_addr_t for end address of the range, can be %NULL 160 */ 161 #define for_each_physmem_range(i, type, p_start, p_end) \ 162 for (i = 0, __next_physmem_range(&i, type, p_start, p_end); \ 163 i != (u64)ULLONG_MAX; \ 164 __next_physmem_range(&i, type, p_start, p_end)) 165 #endif /* CONFIG_HAVE_MEMBLOCK_PHYS_MAP */ 166 167 /** 168 * __for_each_mem_range - iterate through memblock areas from type_a and not 169 * included in type_b. Or just type_a if type_b is NULL. 170 * @i: u64 used as loop variable 171 * @type_a: ptr to memblock_type to iterate 172 * @type_b: ptr to memblock_type which excludes from the iteration 173 * @nid: node selector, %NUMA_NO_NODE for all nodes 174 * @flags: pick from blocks based on memory attributes 175 * @p_start: ptr to phys_addr_t for start address of the range, can be %NULL 176 * @p_end: ptr to phys_addr_t for end address of the range, can be %NULL 177 * @p_nid: ptr to int for nid of the range, can be %NULL 178 */ 179 #define __for_each_mem_range(i, type_a, type_b, nid, flags, \ 180 p_start, p_end, p_nid) \ 181 for (i = 0, __next_mem_range(&i, nid, flags, type_a, type_b, \ 182 p_start, p_end, p_nid); \ 183 i != (u64)ULLONG_MAX; \ 184 __next_mem_range(&i, nid, flags, type_a, type_b, \ 185 p_start, p_end, p_nid)) 186 187 /** 188 * __for_each_mem_range_rev - reverse iterate through memblock areas from 189 * type_a and not included in type_b. Or just type_a if type_b is NULL. 190 * @i: u64 used as loop variable 191 * @type_a: ptr to memblock_type to iterate 192 * @type_b: ptr to memblock_type which excludes from the iteration 193 * @nid: node selector, %NUMA_NO_NODE for all nodes 194 * @flags: pick from blocks based on memory attributes 195 * @p_start: ptr to phys_addr_t for start address of the range, can be %NULL 196 * @p_end: ptr to phys_addr_t for end address of the range, can be %NULL 197 * @p_nid: ptr to int for nid of the range, can be %NULL 198 */ 199 #define __for_each_mem_range_rev(i, type_a, type_b, nid, flags, \ 200 p_start, p_end, p_nid) \ 201 for (i = (u64)ULLONG_MAX, \ 202 __next_mem_range_rev(&i, nid, flags, type_a, type_b, \ 203 p_start, p_end, p_nid); \ 204 i != (u64)ULLONG_MAX; \ 205 __next_mem_range_rev(&i, nid, flags, type_a, type_b, \ 206 p_start, p_end, p_nid)) 207 208 /** 209 * for_each_mem_range - iterate through memory areas. 210 * @i: u64 used as loop variable 211 * @p_start: ptr to phys_addr_t for start address of the range, can be %NULL 212 * @p_end: ptr to phys_addr_t for end address of the range, can be %NULL 213 */ 214 #define for_each_mem_range(i, p_start, p_end) \ 215 __for_each_mem_range(i, &memblock.memory, NULL, NUMA_NO_NODE, \ 216 MEMBLOCK_HOTPLUG, p_start, p_end, NULL) 217 218 /** 219 * for_each_mem_range_rev - reverse iterate through memblock areas from 220 * type_a and not included in type_b. Or just type_a if type_b is NULL. 221 * @i: u64 used as loop variable 222 * @p_start: ptr to phys_addr_t for start address of the range, can be %NULL 223 * @p_end: ptr to phys_addr_t for end address of the range, can be %NULL 224 */ 225 #define for_each_mem_range_rev(i, p_start, p_end) \ 226 __for_each_mem_range_rev(i, &memblock.memory, NULL, NUMA_NO_NODE, \ 227 MEMBLOCK_HOTPLUG, p_start, p_end, NULL) 228 229 /** 230 * for_each_reserved_mem_range - iterate over all reserved memblock areas 231 * @i: u64 used as loop variable 232 * @p_start: ptr to phys_addr_t for start address of the range, can be %NULL 233 * @p_end: ptr to phys_addr_t for end address of the range, can be %NULL 234 * 235 * Walks over reserved areas of memblock. Available as soon as memblock 236 * is initialized. 237 */ 238 #define for_each_reserved_mem_range(i, p_start, p_end) \ 239 __for_each_mem_range(i, &memblock.reserved, NULL, NUMA_NO_NODE, \ 240 MEMBLOCK_NONE, p_start, p_end, NULL) 241 242 static inline bool memblock_is_hotpluggable(struct memblock_region *m) 243 { 244 return m->flags & MEMBLOCK_HOTPLUG; 245 } 246 247 static inline bool memblock_is_mirror(struct memblock_region *m) 248 { 249 return m->flags & MEMBLOCK_MIRROR; 250 } 251 252 static inline bool memblock_is_nomap(struct memblock_region *m) 253 { 254 return m->flags & MEMBLOCK_NOMAP; 255 } 256 257 int memblock_search_pfn_nid(unsigned long pfn, unsigned long *start_pfn, 258 unsigned long *end_pfn); 259 void __next_mem_pfn_range(int *idx, int nid, unsigned long *out_start_pfn, 260 unsigned long *out_end_pfn, int *out_nid); 261 262 /** 263 * for_each_mem_pfn_range - early memory pfn range iterator 264 * @i: an integer used as loop variable 265 * @nid: node selector, %MAX_NUMNODES for all nodes 266 * @p_start: ptr to ulong for start pfn of the range, can be %NULL 267 * @p_end: ptr to ulong for end pfn of the range, can be %NULL 268 * @p_nid: ptr to int for nid of the range, can be %NULL 269 * 270 * Walks over configured memory ranges. 271 */ 272 #define for_each_mem_pfn_range(i, nid, p_start, p_end, p_nid) \ 273 for (i = -1, __next_mem_pfn_range(&i, nid, p_start, p_end, p_nid); \ 274 i >= 0; __next_mem_pfn_range(&i, nid, p_start, p_end, p_nid)) 275 276 #ifdef CONFIG_DEFERRED_STRUCT_PAGE_INIT 277 void __next_mem_pfn_range_in_zone(u64 *idx, struct zone *zone, 278 unsigned long *out_spfn, 279 unsigned long *out_epfn); 280 /** 281 * for_each_free_mem_pfn_range_in_zone - iterate through zone specific free 282 * memblock areas 283 * @i: u64 used as loop variable 284 * @zone: zone in which all of the memory blocks reside 285 * @p_start: ptr to phys_addr_t for start address of the range, can be %NULL 286 * @p_end: ptr to phys_addr_t for end address of the range, can be %NULL 287 * 288 * Walks over free (memory && !reserved) areas of memblock in a specific 289 * zone. Available once memblock and an empty zone is initialized. The main 290 * assumption is that the zone start, end, and pgdat have been associated. 291 * This way we can use the zone to determine NUMA node, and if a given part 292 * of the memblock is valid for the zone. 293 */ 294 #define for_each_free_mem_pfn_range_in_zone(i, zone, p_start, p_end) \ 295 for (i = 0, \ 296 __next_mem_pfn_range_in_zone(&i, zone, p_start, p_end); \ 297 i != U64_MAX; \ 298 __next_mem_pfn_range_in_zone(&i, zone, p_start, p_end)) 299 300 /** 301 * for_each_free_mem_pfn_range_in_zone_from - iterate through zone specific 302 * free memblock areas from a given point 303 * @i: u64 used as loop variable 304 * @zone: zone in which all of the memory blocks reside 305 * @p_start: ptr to phys_addr_t for start address of the range, can be %NULL 306 * @p_end: ptr to phys_addr_t for end address of the range, can be %NULL 307 * 308 * Walks over free (memory && !reserved) areas of memblock in a specific 309 * zone, continuing from current position. Available as soon as memblock is 310 * initialized. 311 */ 312 #define for_each_free_mem_pfn_range_in_zone_from(i, zone, p_start, p_end) \ 313 for (; i != U64_MAX; \ 314 __next_mem_pfn_range_in_zone(&i, zone, p_start, p_end)) 315 316 int __init deferred_page_init_max_threads(const struct cpumask *node_cpumask); 317 318 #endif /* CONFIG_DEFERRED_STRUCT_PAGE_INIT */ 319 320 /** 321 * for_each_free_mem_range - iterate through free memblock areas 322 * @i: u64 used as loop variable 323 * @nid: node selector, %NUMA_NO_NODE for all nodes 324 * @flags: pick from blocks based on memory attributes 325 * @p_start: ptr to phys_addr_t for start address of the range, can be %NULL 326 * @p_end: ptr to phys_addr_t for end address of the range, can be %NULL 327 * @p_nid: ptr to int for nid of the range, can be %NULL 328 * 329 * Walks over free (memory && !reserved) areas of memblock. Available as 330 * soon as memblock is initialized. 331 */ 332 #define for_each_free_mem_range(i, nid, flags, p_start, p_end, p_nid) \ 333 __for_each_mem_range(i, &memblock.memory, &memblock.reserved, \ 334 nid, flags, p_start, p_end, p_nid) 335 336 /** 337 * for_each_free_mem_range_reverse - rev-iterate through free memblock areas 338 * @i: u64 used as loop variable 339 * @nid: node selector, %NUMA_NO_NODE for all nodes 340 * @flags: pick from blocks based on memory attributes 341 * @p_start: ptr to phys_addr_t for start address of the range, can be %NULL 342 * @p_end: ptr to phys_addr_t for end address of the range, can be %NULL 343 * @p_nid: ptr to int for nid of the range, can be %NULL 344 * 345 * Walks over free (memory && !reserved) areas of memblock in reverse 346 * order. Available as soon as memblock is initialized. 347 */ 348 #define for_each_free_mem_range_reverse(i, nid, flags, p_start, p_end, \ 349 p_nid) \ 350 __for_each_mem_range_rev(i, &memblock.memory, &memblock.reserved, \ 351 nid, flags, p_start, p_end, p_nid) 352 353 int memblock_set_node(phys_addr_t base, phys_addr_t size, 354 struct memblock_type *type, int nid); 355 356 #ifdef CONFIG_NUMA 357 static inline void memblock_set_region_node(struct memblock_region *r, int nid) 358 { 359 r->nid = nid; 360 } 361 362 static inline int memblock_get_region_node(const struct memblock_region *r) 363 { 364 return r->nid; 365 } 366 #else 367 static inline void memblock_set_region_node(struct memblock_region *r, int nid) 368 { 369 } 370 371 static inline int memblock_get_region_node(const struct memblock_region *r) 372 { 373 return 0; 374 } 375 #endif /* CONFIG_NUMA */ 376 377 /* Flags for memblock allocation APIs */ 378 #define MEMBLOCK_ALLOC_ANYWHERE (~(phys_addr_t)0) 379 #define MEMBLOCK_ALLOC_ACCESSIBLE 0 380 #define MEMBLOCK_ALLOC_KASAN 1 381 382 /* We are using top down, so it is safe to use 0 here */ 383 #define MEMBLOCK_LOW_LIMIT 0 384 385 #ifndef ARCH_LOW_ADDRESS_LIMIT 386 #define ARCH_LOW_ADDRESS_LIMIT 0xffffffffUL 387 #endif 388 389 phys_addr_t memblock_phys_alloc_range(phys_addr_t size, phys_addr_t align, 390 phys_addr_t start, phys_addr_t end); 391 phys_addr_t memblock_alloc_range_nid(phys_addr_t size, 392 phys_addr_t align, phys_addr_t start, 393 phys_addr_t end, int nid, bool exact_nid); 394 phys_addr_t memblock_phys_alloc_try_nid(phys_addr_t size, phys_addr_t align, int nid); 395 396 static inline phys_addr_t memblock_phys_alloc(phys_addr_t size, 397 phys_addr_t align) 398 { 399 return memblock_phys_alloc_range(size, align, 0, 400 MEMBLOCK_ALLOC_ACCESSIBLE); 401 } 402 403 void *memblock_alloc_exact_nid_raw(phys_addr_t size, phys_addr_t align, 404 phys_addr_t min_addr, phys_addr_t max_addr, 405 int nid); 406 void *memblock_alloc_try_nid_raw(phys_addr_t size, phys_addr_t align, 407 phys_addr_t min_addr, phys_addr_t max_addr, 408 int nid); 409 void *memblock_alloc_try_nid(phys_addr_t size, phys_addr_t align, 410 phys_addr_t min_addr, phys_addr_t max_addr, 411 int nid); 412 413 static __always_inline void *memblock_alloc(phys_addr_t size, phys_addr_t align) 414 { 415 return memblock_alloc_try_nid(size, align, MEMBLOCK_LOW_LIMIT, 416 MEMBLOCK_ALLOC_ACCESSIBLE, NUMA_NO_NODE); 417 } 418 419 static inline void *memblock_alloc_raw(phys_addr_t size, 420 phys_addr_t align) 421 { 422 return memblock_alloc_try_nid_raw(size, align, MEMBLOCK_LOW_LIMIT, 423 MEMBLOCK_ALLOC_ACCESSIBLE, 424 NUMA_NO_NODE); 425 } 426 427 static inline void *memblock_alloc_from(phys_addr_t size, 428 phys_addr_t align, 429 phys_addr_t min_addr) 430 { 431 return memblock_alloc_try_nid(size, align, min_addr, 432 MEMBLOCK_ALLOC_ACCESSIBLE, NUMA_NO_NODE); 433 } 434 435 static inline void *memblock_alloc_low(phys_addr_t size, 436 phys_addr_t align) 437 { 438 return memblock_alloc_try_nid(size, align, MEMBLOCK_LOW_LIMIT, 439 ARCH_LOW_ADDRESS_LIMIT, NUMA_NO_NODE); 440 } 441 442 static inline void *memblock_alloc_node(phys_addr_t size, 443 phys_addr_t align, int nid) 444 { 445 return memblock_alloc_try_nid(size, align, MEMBLOCK_LOW_LIMIT, 446 MEMBLOCK_ALLOC_ACCESSIBLE, nid); 447 } 448 449 /* 450 * Set the allocation direction to bottom-up or top-down. 451 */ 452 static inline __init_memblock void memblock_set_bottom_up(bool enable) 453 { 454 memblock.bottom_up = enable; 455 } 456 457 /* 458 * Check if the allocation direction is bottom-up or not. 459 * if this is true, that said, memblock will allocate memory 460 * in bottom-up direction. 461 */ 462 static inline __init_memblock bool memblock_bottom_up(void) 463 { 464 return memblock.bottom_up; 465 } 466 467 phys_addr_t memblock_phys_mem_size(void); 468 phys_addr_t memblock_reserved_size(void); 469 phys_addr_t memblock_start_of_DRAM(void); 470 phys_addr_t memblock_end_of_DRAM(void); 471 void memblock_enforce_memory_limit(phys_addr_t memory_limit); 472 void memblock_cap_memory_range(phys_addr_t base, phys_addr_t size); 473 void memblock_mem_limit_remove_map(phys_addr_t limit); 474 bool memblock_is_memory(phys_addr_t addr); 475 bool memblock_is_map_memory(phys_addr_t addr); 476 bool memblock_is_region_memory(phys_addr_t base, phys_addr_t size); 477 bool memblock_is_reserved(phys_addr_t addr); 478 bool memblock_is_region_reserved(phys_addr_t base, phys_addr_t size); 479 480 void memblock_dump_all(void); 481 482 /** 483 * memblock_set_current_limit - Set the current allocation limit to allow 484 * limiting allocations to what is currently 485 * accessible during boot 486 * @limit: New limit value (physical address) 487 */ 488 void memblock_set_current_limit(phys_addr_t limit); 489 490 491 phys_addr_t memblock_get_current_limit(void); 492 493 /* 494 * pfn conversion functions 495 * 496 * While the memory MEMBLOCKs should always be page aligned, the reserved 497 * MEMBLOCKs may not be. This accessor attempt to provide a very clear 498 * idea of what they return for such non aligned MEMBLOCKs. 499 */ 500 501 /** 502 * memblock_region_memory_base_pfn - get the lowest pfn of the memory region 503 * @reg: memblock_region structure 504 * 505 * Return: the lowest pfn intersecting with the memory region 506 */ 507 static inline unsigned long memblock_region_memory_base_pfn(const struct memblock_region *reg) 508 { 509 return PFN_UP(reg->base); 510 } 511 512 /** 513 * memblock_region_memory_end_pfn - get the end pfn of the memory region 514 * @reg: memblock_region structure 515 * 516 * Return: the end_pfn of the reserved region 517 */ 518 static inline unsigned long memblock_region_memory_end_pfn(const struct memblock_region *reg) 519 { 520 return PFN_DOWN(reg->base + reg->size); 521 } 522 523 /** 524 * memblock_region_reserved_base_pfn - get the lowest pfn of the reserved region 525 * @reg: memblock_region structure 526 * 527 * Return: the lowest pfn intersecting with the reserved region 528 */ 529 static inline unsigned long memblock_region_reserved_base_pfn(const struct memblock_region *reg) 530 { 531 return PFN_DOWN(reg->base); 532 } 533 534 /** 535 * memblock_region_reserved_end_pfn - get the end pfn of the reserved region 536 * @reg: memblock_region structure 537 * 538 * Return: the end_pfn of the reserved region 539 */ 540 static inline unsigned long memblock_region_reserved_end_pfn(const struct memblock_region *reg) 541 { 542 return PFN_UP(reg->base + reg->size); 543 } 544 545 /** 546 * for_each_mem_region - itereate over memory regions 547 * @region: loop variable 548 */ 549 #define for_each_mem_region(region) \ 550 for (region = memblock.memory.regions; \ 551 region < (memblock.memory.regions + memblock.memory.cnt); \ 552 region++) 553 554 /** 555 * for_each_reserved_mem_region - itereate over reserved memory regions 556 * @region: loop variable 557 */ 558 #define for_each_reserved_mem_region(region) \ 559 for (region = memblock.reserved.regions; \ 560 region < (memblock.reserved.regions + memblock.reserved.cnt); \ 561 region++) 562 563 extern void *alloc_large_system_hash(const char *tablename, 564 unsigned long bucketsize, 565 unsigned long numentries, 566 int scale, 567 int flags, 568 unsigned int *_hash_shift, 569 unsigned int *_hash_mask, 570 unsigned long low_limit, 571 unsigned long high_limit); 572 573 #define HASH_EARLY 0x00000001 /* Allocating during early boot? */ 574 #define HASH_SMALL 0x00000002 /* sub-page allocation allowed, min 575 * shift passed via *_hash_shift */ 576 #define HASH_ZERO 0x00000004 /* Zero allocated hash table */ 577 578 /* Only NUMA needs hash distribution. 64bit NUMA architectures have 579 * sufficient vmalloc space. 580 */ 581 #ifdef CONFIG_NUMA 582 #define HASHDIST_DEFAULT IS_ENABLED(CONFIG_64BIT) 583 extern int hashdist; /* Distribute hashes across NUMA nodes? */ 584 #else 585 #define hashdist (0) 586 #endif 587 588 #ifdef CONFIG_MEMTEST 589 extern void early_memtest(phys_addr_t start, phys_addr_t end); 590 #else 591 static inline void early_memtest(phys_addr_t start, phys_addr_t end) 592 { 593 } 594 #endif 595 596 #endif /* __KERNEL__ */ 597 598 #endif /* _LINUX_MEMBLOCK_H */ 599