| @@ -18,18 +18,29 @@ static const unsigned int node_fractions[] = { · 17 unmodified lines |
| 18 | 625, /* 1/16 */ | 18 | 625, /* 1/16 */ |
| 19 | }; | 19 | }; |
| 20 | | 20 | |
| 21 | static inline const char * const get_memblock_alloc_try_nid_name(int flags) | 21 | static inline const char * const get_memblock_alloc_nid_name(int flags) |
| 22 | { | 22 | { |
| | 23 | if (flags & TEST_F_EXACT) |
| | 24 | return "memblock_alloc_exact_nid_raw"; |
| 23 | if (flags & TEST_F_RAW) | 25 | if (flags & TEST_F_RAW) |
| 24 | return "memblock_alloc_try_nid_raw"; | 26 | return "memblock_alloc_try_nid_raw"; |
| 25 | return "memblock_alloc_try_nid"; | 27 | return "memblock_alloc_try_nid"; |
| 26 | } | 28 | } |
| 27 | | 29 | |
| 28 | static inline void *run_memblock_alloc_try_nid(phys_addr_t size, | 30 | static inline void *run_memblock_alloc_nid(phys_addr_t size, |
| 29 | phys_addr_t align, | 31 | phys_addr_t align, |
| 30 | phys_addr_t min_addr, | 32 | phys_addr_t min_addr, |
| 31 | phys_addr_t max_addr, int nid) | 33 | phys_addr_t max_addr, int nid) |
| 32 | { | 34 | { |
| | 35 | assert(!(alloc_nid_test_flags & TEST_F_EXACT) || |
| | 36 | (alloc_nid_test_flags & TEST_F_RAW)); |
| | 37 | /* |
| | 38 | * TEST_F_EXACT should be checked before TEST_F_RAW since |
| | 39 | * memblock_alloc_exact_nid_raw() performs raw allocations. |
| | 40 | */ |
| | 41 | if (alloc_nid_test_flags & TEST_F_EXACT) |
| | 42 | return memblock_alloc_exact_nid_raw(size, align, min_addr, |
| | 43 | max_addr, nid); |
| 33 | if (alloc_nid_test_flags & TEST_F_RAW) | 44 | if (alloc_nid_test_flags & TEST_F_RAW) |
| 34 | return memblock_alloc_try_nid_raw(size, align, min_addr, | 45 | return memblock_alloc_try_nid_raw(size, align, min_addr, |
| 35 | max_addr, nid); | 46 | max_addr, nid); |
| @@ -50,7 +61,7 @@ static inline void *run_memblock_alloc_try_nid(phys_addr_t size, · 14 unmodified lines |
| 50 | * | 61 | * |
| 51 | * Expect to allocate a region that ends at max_addr. | 62 | * Expect to allocate a region that ends at max_addr. |
| 52 | */ | 63 | */ |
| 53 | static int alloc_try_nid_top_down_simple_check(void) | 64 | static int alloc_nid_top_down_simple_check(void) |
| 54 | { | 65 | { |
| 55 | struct memblock_region *rgn = &memblock.reserved.regions[0]; | 66 | struct memblock_region *rgn = &memblock.reserved.regions[0]; |
| 56 | void *allocated_ptr = NULL; | 67 | void *allocated_ptr = NULL; |
| @@ -65,9 +76,9 @@ static int alloc_try_nid_top_down_simple_check(void) · 8 unmodified lines |
| 65 | min_addr = memblock_start_of_DRAM() + SMP_CACHE_BYTES * 2; | 76 | min_addr = memblock_start_of_DRAM() + SMP_CACHE_BYTES * 2; |
| 66 | max_addr = min_addr + SZ_512; | 77 | max_addr = min_addr + SZ_512; |
| 67 | | 78 | |
| 68 | allocated_ptr = run_memblock_alloc_try_nid(size, SMP_CACHE_BYTES, | 79 | allocated_ptr = run_memblock_alloc_nid(size, SMP_CACHE_BYTES, |
| 69 | min_addr, max_addr, | 80 | min_addr, max_addr, |
| 70 | NUMA_NO_NODE); | 81 | NUMA_NO_NODE); |
| 71 | rgn_end = rgn->base + rgn->size; | 82 | rgn_end = rgn->base + rgn->size; |
| 72 | | 83 | |
| 73 | ASSERT_NE(allocated_ptr, NULL); | 84 | ASSERT_NE(allocated_ptr, NULL); |
| @@ -102,7 +113,7 @@ static int alloc_try_nid_top_down_simple_check(void) · 28 unmodified lines |
| 102 | * | 113 | * |
| 103 | * Expect to allocate an aligned region that ends before max_addr. | 114 | * Expect to allocate an aligned region that ends before max_addr. |
| 104 | */ | 115 | */ |
| 105 | static int alloc_try_nid_top_down_end_misaligned_check(void) | 116 | static int alloc_nid_top_down_end_misaligned_check(void) |
| 106 | { | 117 | { |
| 107 | struct memblock_region *rgn = &memblock.reserved.regions[0]; | 118 | struct memblock_region *rgn = &memblock.reserved.regions[0]; |
| 108 | void *allocated_ptr = NULL; | 119 | void *allocated_ptr = NULL; |
| @@ -118,9 +129,9 @@ static int alloc_try_nid_top_down_end_misaligned_check(void) · 9 unmodified lines |
| 118 | min_addr = memblock_start_of_DRAM() + SMP_CACHE_BYTES * 2; | 129 | min_addr = memblock_start_of_DRAM() + SMP_CACHE_BYTES * 2; |
| 119 | max_addr = min_addr + SZ_512 + misalign; | 130 | max_addr = min_addr + SZ_512 + misalign; |
| 120 | | 131 | |
| 121 | allocated_ptr = run_memblock_alloc_try_nid(size, SMP_CACHE_BYTES, | 132 | allocated_ptr = run_memblock_alloc_nid(size, SMP_CACHE_BYTES, |
| 122 | min_addr, max_addr, | 133 | min_addr, max_addr, |
| 123 | NUMA_NO_NODE); | 134 | NUMA_NO_NODE); |
| 124 | rgn_end = rgn->base + rgn->size; | 135 | rgn_end = rgn->base + rgn->size; |
| 125 | | 136 | |
| 126 | ASSERT_NE(allocated_ptr, NULL); | 137 | ASSERT_NE(allocated_ptr, NULL); |
| @@ -153,7 +164,7 @@ static int alloc_try_nid_top_down_end_misaligned_check(void) · 26 unmodified lines |
| 153 | * Expect to allocate a region that starts at min_addr and ends at | 164 | * Expect to allocate a region that starts at min_addr and ends at |
| 154 | * max_addr, given that min_addr is aligned. | 165 | * max_addr, given that min_addr is aligned. |
| 155 | */ | 166 | */ |
| 156 | static int alloc_try_nid_exact_address_generic_check(void) | 167 | static int alloc_nid_exact_address_generic_check(void) |
| 157 | { | 168 | { |
| 158 | struct memblock_region *rgn = &memblock.reserved.regions[0]; | 169 | struct memblock_region *rgn = &memblock.reserved.regions[0]; |
| 159 | void *allocated_ptr = NULL; | 170 | void *allocated_ptr = NULL; |
| @@ -168,9 +179,9 @@ static int alloc_try_nid_exact_address_generic_check(void) · 8 unmodified lines |
| 168 | min_addr = memblock_start_of_DRAM() + SMP_CACHE_BYTES; | 179 | min_addr = memblock_start_of_DRAM() + SMP_CACHE_BYTES; |
| 169 | max_addr = min_addr + size; | 180 | max_addr = min_addr + size; |
| 170 | | 181 | |
| 171 | allocated_ptr = run_memblock_alloc_try_nid(size, SMP_CACHE_BYTES, | 182 | allocated_ptr = run_memblock_alloc_nid(size, SMP_CACHE_BYTES, |
| 172 | min_addr, max_addr, | 183 | min_addr, max_addr, |
| 173 | NUMA_NO_NODE); | 184 | NUMA_NO_NODE); |
| 174 | rgn_end = rgn->base + rgn->size; | 185 | rgn_end = rgn->base + rgn->size; |
| 175 | | 186 | |
| 176 | ASSERT_NE(allocated_ptr, NULL); | 187 | ASSERT_NE(allocated_ptr, NULL); |
| @@ -205,7 +216,7 @@ static int alloc_try_nid_exact_address_generic_check(void) · 28 unmodified lines |
| 205 | * Expect to drop the lower limit and allocate a memory region which | 216 | * Expect to drop the lower limit and allocate a memory region which |
| 206 | * ends at max_addr (if the address is aligned). | 217 | * ends at max_addr (if the address is aligned). |
| 207 | */ | 218 | */ |
| 208 | static int alloc_try_nid_top_down_narrow_range_check(void) | 219 | static int alloc_nid_top_down_narrow_range_check(void) |
| 209 | { | 220 | { |
| 210 | struct memblock_region *rgn = &memblock.reserved.regions[0]; | 221 | struct memblock_region *rgn = &memblock.reserved.regions[0]; |
| 211 | void *allocated_ptr = NULL; | 222 | void *allocated_ptr = NULL; |
| @@ -219,9 +230,9 @@ static int alloc_try_nid_top_down_narrow_range_check(void) · 7 unmodified lines |
| 219 | min_addr = memblock_start_of_DRAM() + SZ_512; | 230 | min_addr = memblock_start_of_DRAM() + SZ_512; |
| 220 | max_addr = min_addr + SMP_CACHE_BYTES; | 231 | max_addr = min_addr + SMP_CACHE_BYTES; |
| 221 | | 232 | |
| 222 | allocated_ptr = run_memblock_alloc_try_nid(size, SMP_CACHE_BYTES, | 233 | allocated_ptr = run_memblock_alloc_nid(size, SMP_CACHE_BYTES, |
| 223 | min_addr, max_addr, | 234 | min_addr, max_addr, |
| 224 | NUMA_NO_NODE); | 235 | NUMA_NO_NODE); |
| 225 | | 236 | |
| 226 | ASSERT_NE(allocated_ptr, NULL); | 237 | ASSERT_NE(allocated_ptr, NULL); |
| 227 | assert_mem_content(allocated_ptr, size, alloc_nid_test_flags); | 238 | assert_mem_content(allocated_ptr, size, alloc_nid_test_flags); |
| @@ -257,7 +268,7 @@ static int alloc_try_nid_top_down_narrow_range_check(void) · 29 unmodified lines |
| 257 | * | 268 | * |
| 258 | * Expect no allocation to happen. | 269 | * Expect no allocation to happen. |
| 259 | */ | 270 | */ |
| 260 | static int alloc_try_nid_low_max_generic_check(void) | 271 | static int alloc_nid_low_max_generic_check(void) |
| 261 | { | 272 | { |
| 262 | void *allocated_ptr = NULL; | 273 | void *allocated_ptr = NULL; |
| 263 | phys_addr_t size = SZ_1K; | 274 | phys_addr_t size = SZ_1K; |
| @@ -270,9 +281,9 @@ static int alloc_try_nid_low_max_generic_check(void) · 6 unmodified lines |
| 270 | min_addr = memblock_start_of_DRAM(); | 281 | min_addr = memblock_start_of_DRAM(); |
| 271 | max_addr = min_addr + SMP_CACHE_BYTES; | 282 | max_addr = min_addr + SMP_CACHE_BYTES; |
| 272 | | 283 | |
| 273 | allocated_ptr = run_memblock_alloc_try_nid(size, SMP_CACHE_BYTES, | 284 | allocated_ptr = run_memblock_alloc_nid(size, SMP_CACHE_BYTES, |
| 274 | min_addr, max_addr, | 285 | min_addr, max_addr, |
| 275 | NUMA_NO_NODE); | 286 | NUMA_NO_NODE); |
| 276 | | 287 | |
| 277 | ASSERT_EQ(allocated_ptr, NULL); | 288 | ASSERT_EQ(allocated_ptr, NULL); |
| 278 | | 289 | |
| @@ -295,7 +306,7 @@ static int alloc_try_nid_low_max_generic_check(void) · 16 unmodified lines |
| 295 | * | 306 | * |
| 296 | * Expect a merge of both regions. Only the region size gets updated. | 307 | * Expect a merge of both regions. Only the region size gets updated. |
| 297 | */ | 308 | */ |
| 298 | static int alloc_try_nid_min_reserved_generic_check(void) | 309 | static int alloc_nid_min_reserved_generic_check(void) |
| 299 | { | 310 | { |
| 300 | struct memblock_region *rgn = &memblock.reserved.regions[0]; | 311 | struct memblock_region *rgn = &memblock.reserved.regions[0]; |
| 301 | void *allocated_ptr = NULL; | 312 | void *allocated_ptr = NULL; |
| @@ -315,9 +326,9 @@ static int alloc_try_nid_min_reserved_generic_check(void) · 13 unmodified lines |
| 315 | | 326 | |
| 316 | memblock_reserve(reserved_base, r1_size); | 327 | memblock_reserve(reserved_base, r1_size); |
| 317 | | 328 | |
| 318 | allocated_ptr = run_memblock_alloc_try_nid(r2_size, SMP_CACHE_BYTES, | 329 | allocated_ptr = run_memblock_alloc_nid(r2_size, SMP_CACHE_BYTES, |
| 319 | min_addr, max_addr, | 330 | min_addr, max_addr, |
| 320 | NUMA_NO_NODE); | 331 | NUMA_NO_NODE); |
| 321 | | 332 | |
| 322 | ASSERT_NE(allocated_ptr, NULL); | 333 | ASSERT_NE(allocated_ptr, NULL); |
| 323 | assert_mem_content(allocated_ptr, r2_size, alloc_nid_test_flags); | 334 | assert_mem_content(allocated_ptr, r2_size, alloc_nid_test_flags); |
| @@ -347,7 +358,7 @@ static int alloc_try_nid_min_reserved_generic_check(void) · 23 unmodified lines |
| 347 | * | 358 | * |
| 348 | * Expect a merge of regions. Only the region size gets updated. | 359 | * Expect a merge of regions. Only the region size gets updated. |
| 349 | */ | 360 | */ |
| 350 | static int alloc_try_nid_max_reserved_generic_check(void) | 361 | static int alloc_nid_max_reserved_generic_check(void) |
| 351 | { | 362 | { |
| 352 | struct memblock_region *rgn = &memblock.reserved.regions[0]; | 363 | struct memblock_region *rgn = &memblock.reserved.regions[0]; |
| 353 | void *allocated_ptr = NULL; | 364 | void *allocated_ptr = NULL; |
| @@ -365,9 +376,9 @@ static int alloc_try_nid_max_reserved_generic_check(void) · 11 unmodified lines |
| 365 | | 376 | |
| 366 | memblock_reserve(max_addr, r1_size); | 377 | memblock_reserve(max_addr, r1_size); |
| 367 | | 378 | |
| 368 | allocated_ptr = run_memblock_alloc_try_nid(r2_size, SMP_CACHE_BYTES, | 379 | allocated_ptr = run_memblock_alloc_nid(r2_size, SMP_CACHE_BYTES, |
| 369 | min_addr, max_addr, | 380 | min_addr, max_addr, |
| 370 | NUMA_NO_NODE); | 381 | NUMA_NO_NODE); |
| 371 | | 382 | |
| 372 | ASSERT_NE(allocated_ptr, NULL); | 383 | ASSERT_NE(allocated_ptr, NULL); |
| 373 | assert_mem_content(allocated_ptr, r2_size, alloc_nid_test_flags); | 384 | assert_mem_content(allocated_ptr, r2_size, alloc_nid_test_flags); |
| @@ -400,7 +411,7 @@ static int alloc_try_nid_max_reserved_generic_check(void) · 26 unmodified lines |
| 400 | * updated. The total size field gets updated. | 411 | * updated. The total size field gets updated. |
| 401 | */ | 412 | */ |
| 402 | | 413 | |
| 403 | static int alloc_try_nid_top_down_reserved_with_space_check(void) | 414 | static int alloc_nid_top_down_reserved_with_space_check(void) |
| 404 | { | 415 | { |
| 405 | struct memblock_region *rgn1 = &memblock.reserved.regions[1]; | 416 | struct memblock_region *rgn1 = &memblock.reserved.regions[1]; |
| 406 | struct memblock_region *rgn2 = &memblock.reserved.regions[0]; | 417 | struct memblock_region *rgn2 = &memblock.reserved.regions[0]; |
| @@ -428,9 +439,9 @@ static int alloc_try_nid_top_down_reserved_with_space_check(void) · 21 unmodified lines |
| 428 | memblock_reserve(r1.base, r1.size); | 439 | memblock_reserve(r1.base, r1.size); |
| 429 | memblock_reserve(r2.base, r2.size); | 440 | memblock_reserve(r2.base, r2.size); |
| 430 | | 441 | |
| 431 | allocated_ptr = run_memblock_alloc_try_nid(r3_size, SMP_CACHE_BYTES, | 442 | allocated_ptr = run_memblock_alloc_nid(r3_size, SMP_CACHE_BYTES, |
| 432 | min_addr, max_addr, | 443 | min_addr, max_addr, |
| 433 | NUMA_NO_NODE); | 444 | NUMA_NO_NODE); |
| 434 | | 445 | |
| 435 | ASSERT_NE(allocated_ptr, NULL); | 446 | ASSERT_NE(allocated_ptr, NULL); |
| 436 | assert_mem_content(allocated_ptr, r3_size, alloc_nid_test_flags); | 447 | assert_mem_content(allocated_ptr, r3_size, alloc_nid_test_flags); |
| @@ -465,7 +476,7 @@ static int alloc_try_nid_top_down_reserved_with_space_check(void) · 28 unmodified lines |
| 465 | * Expect to merge all of the regions into one. The region counter and total | 476 | * Expect to merge all of the regions into one. The region counter and total |
| 466 | * size fields get updated. | 477 | * size fields get updated. |
| 467 | */ | 478 | */ |
| 468 | static int alloc_try_nid_reserved_full_merge_generic_check(void) | 479 | static int alloc_nid_reserved_full_merge_generic_check(void) |
| 469 | { | 480 | { |
| 470 | struct memblock_region *rgn = &memblock.reserved.regions[0]; | 481 | struct memblock_region *rgn = &memblock.reserved.regions[0]; |
| 471 | void *allocated_ptr = NULL; | 482 | void *allocated_ptr = NULL; |
| @@ -491,9 +502,9 @@ static int alloc_try_nid_reserved_full_merge_generic_check(void) · 19 unmodified lines |
| 491 | memblock_reserve(r1.base, r1.size); | 502 | memblock_reserve(r1.base, r1.size); |
| 492 | memblock_reserve(r2.base, r2.size); | 503 | memblock_reserve(r2.base, r2.size); |
| 493 | | 504 | |
| 494 | allocated_ptr = run_memblock_alloc_try_nid(r3_size, SMP_CACHE_BYTES, | 505 | allocated_ptr = run_memblock_alloc_nid(r3_size, SMP_CACHE_BYTES, |
| 495 | min_addr, max_addr, | 506 | min_addr, max_addr, |
| 496 | NUMA_NO_NODE); | 507 | NUMA_NO_NODE); |
| 497 | | 508 | |
| 498 | ASSERT_NE(allocated_ptr, NULL); | 509 | ASSERT_NE(allocated_ptr, NULL); |
| 499 | assert_mem_content(allocated_ptr, r3_size, alloc_nid_test_flags); | 510 | assert_mem_content(allocated_ptr, r3_size, alloc_nid_test_flags); |
| @@ -527,7 +538,7 @@ static int alloc_try_nid_reserved_full_merge_generic_check(void) · 27 unmodified lines |
| 527 | * Expect to merge the new region with r2. The second region does not get | 538 | * Expect to merge the new region with r2. The second region does not get |
| 528 | * updated. The total size counter gets updated. | 539 | * updated. The total size counter gets updated. |
| 529 | */ | 540 | */ |
| 530 | static int alloc_try_nid_top_down_reserved_no_space_check(void) | 541 | static int alloc_nid_top_down_reserved_no_space_check(void) |
| 531 | { | 542 | { |
| 532 | struct memblock_region *rgn1 = &memblock.reserved.regions[1]; | 543 | struct memblock_region *rgn1 = &memblock.reserved.regions[1]; |
| 533 | struct memblock_region *rgn2 = &memblock.reserved.regions[0]; | 544 | struct memblock_region *rgn2 = &memblock.reserved.regions[0]; |
| @@ -555,9 +566,9 @@ static int alloc_try_nid_top_down_reserved_no_space_check(void) · 21 unmodified lines |
| 555 | memblock_reserve(r1.base, r1.size); | 566 | memblock_reserve(r1.base, r1.size); |
| 556 | memblock_reserve(r2.base, r2.size); | 567 | memblock_reserve(r2.base, r2.size); |
| 557 | | 568 | |
| 558 | allocated_ptr = run_memblock_alloc_try_nid(r3_size, SMP_CACHE_BYTES, | 569 | allocated_ptr = run_memblock_alloc_nid(r3_size, SMP_CACHE_BYTES, |
| 559 | min_addr, max_addr, | 570 | min_addr, max_addr, |
| 560 | NUMA_NO_NODE); | 571 | NUMA_NO_NODE); |
| 561 | | 572 | |
| 562 | ASSERT_NE(allocated_ptr, NULL); | 573 | ASSERT_NE(allocated_ptr, NULL); |
| 563 | assert_mem_content(allocated_ptr, r3_size, alloc_nid_test_flags); | 574 | assert_mem_content(allocated_ptr, r3_size, alloc_nid_test_flags); |
| @@ -596,7 +607,7 @@ static int alloc_try_nid_top_down_reserved_no_space_check(void) · 32 unmodified lines |
| 596 | * Expect no allocation to happen. | 607 | * Expect no allocation to happen. |
| 597 | */ | 608 | */ |
| 598 | | 609 | |
| 599 | static int alloc_try_nid_reserved_all_generic_check(void) | 610 | static int alloc_nid_reserved_all_generic_check(void) |
| 600 | { | 611 | { |
| 601 | void *allocated_ptr = NULL; | 612 | void *allocated_ptr = NULL; |
| 602 | struct region r1, r2; | 613 | struct region r1, r2; |
| @@ -620,9 +631,9 @@ static int alloc_try_nid_reserved_all_generic_check(void) · 17 unmodified lines |
| 620 | memblock_reserve(r1.base, r1.size); | 631 | memblock_reserve(r1.base, r1.size); |
| 621 | memblock_reserve(r2.base, r2.size); | 632 | memblock_reserve(r2.base, r2.size); |
| 622 | | 633 | |
| 623 | allocated_ptr = run_memblock_alloc_try_nid(r3_size, SMP_CACHE_BYTES, | 634 | allocated_ptr = run_memblock_alloc_nid(r3_size, SMP_CACHE_BYTES, |
| 624 | min_addr, max_addr, | 635 | min_addr, max_addr, |
| 625 | NUMA_NO_NODE); | 636 | NUMA_NO_NODE); |
| 626 | | 637 | |
| 627 | ASSERT_EQ(allocated_ptr, NULL); | 638 | ASSERT_EQ(allocated_ptr, NULL); |
| 628 | | 639 | |
| @@ -636,7 +647,7 @@ static int alloc_try_nid_reserved_all_generic_check(void) · 7 unmodified lines |
| 636 | * bigger than the end address of the available memory. Expect to allocate | 647 | * bigger than the end address of the available memory. Expect to allocate |
| 637 | * a region that ends before the end of the memory. | 648 | * a region that ends before the end of the memory. |
| 638 | */ | 649 | */ |
| 639 | static int alloc_try_nid_top_down_cap_max_check(void) | 650 | static int alloc_nid_top_down_cap_max_check(void) |
| 640 | { | 651 | { |
| 641 | struct memblock_region *rgn = &memblock.reserved.regions[0]; | 652 | struct memblock_region *rgn = &memblock.reserved.regions[0]; |
| 642 | void *allocated_ptr = NULL; | 653 | void *allocated_ptr = NULL; |
| @@ -650,9 +661,9 @@ static int alloc_try_nid_top_down_cap_max_check(void) · 7 unmodified lines |
| 650 | min_addr = memblock_end_of_DRAM() - SZ_1K; | 661 | min_addr = memblock_end_of_DRAM() - SZ_1K; |
| 651 | max_addr = memblock_end_of_DRAM() + SZ_256; | 662 | max_addr = memblock_end_of_DRAM() + SZ_256; |
| 652 | | 663 | |
| 653 | allocated_ptr = run_memblock_alloc_try_nid(size, SMP_CACHE_BYTES, | 664 | allocated_ptr = run_memblock_alloc_nid(size, SMP_CACHE_BYTES, |
| 654 | min_addr, max_addr, | 665 | min_addr, max_addr, |
| 655 | NUMA_NO_NODE); | 666 | NUMA_NO_NODE); |
| 656 | | 667 | |
| 657 | ASSERT_NE(allocated_ptr, NULL); | 668 | ASSERT_NE(allocated_ptr, NULL); |
| 658 | assert_mem_content(allocated_ptr, size, alloc_nid_test_flags); | 669 | assert_mem_content(allocated_ptr, size, alloc_nid_test_flags); |
| @@ -673,7 +684,7 @@ static int alloc_try_nid_top_down_cap_max_check(void) · 14 unmodified lines |
| 673 | * smaller than the start address of the available memory. Expect to allocate | 684 | * smaller than the start address of the available memory. Expect to allocate |
| 674 | * a region that ends before the end of the memory. | 685 | * a region that ends before the end of the memory. |
| 675 | */ | 686 | */ |
| 676 | static int alloc_try_nid_top_down_cap_min_check(void) | 687 | static int alloc_nid_top_down_cap_min_check(void) |
| 677 | { | 688 | { |
| 678 | struct memblock_region *rgn = &memblock.reserved.regions[0]; | 689 | struct memblock_region *rgn = &memblock.reserved.regions[0]; |
| 679 | void *allocated_ptr = NULL; | 690 | void *allocated_ptr = NULL; |
| @@ -687,9 +698,9 @@ static int alloc_try_nid_top_down_cap_min_check(void) · 7 unmodified lines |
| 687 | min_addr = memblock_start_of_DRAM() - SZ_256; | 698 | min_addr = memblock_start_of_DRAM() - SZ_256; |
| 688 | max_addr = memblock_end_of_DRAM(); | 699 | max_addr = memblock_end_of_DRAM(); |
| 689 | | 700 | |
| 690 | allocated_ptr = run_memblock_alloc_try_nid(size, SMP_CACHE_BYTES, | 701 | allocated_ptr = run_memblock_alloc_nid(size, SMP_CACHE_BYTES, |
| 691 | min_addr, max_addr, | 702 | min_addr, max_addr, |
| 692 | NUMA_NO_NODE); | 703 | NUMA_NO_NODE); |
| 693 | | 704 | |
| 694 | ASSERT_NE(allocated_ptr, NULL); | 705 | ASSERT_NE(allocated_ptr, NULL); |
| 695 | assert_mem_content(allocated_ptr, size, alloc_nid_test_flags); | 706 | assert_mem_content(allocated_ptr, size, alloc_nid_test_flags); |
| @@ -719,7 +730,7 @@ static int alloc_try_nid_top_down_cap_min_check(void) · 23 unmodified lines |
| 719 | * | 730 | * |
| 720 | * Expect to allocate a region that ends before max_addr. | 731 | * Expect to allocate a region that ends before max_addr. |
| 721 | */ | 732 | */ |
| 722 | static int alloc_try_nid_bottom_up_simple_check(void) | 733 | static int alloc_nid_bottom_up_simple_check(void) |
| 723 | { | 734 | { |
| 724 | struct memblock_region *rgn = &memblock.reserved.regions[0]; | 735 | struct memblock_region *rgn = &memblock.reserved.regions[0]; |
| 725 | void *allocated_ptr = NULL; | 736 | void *allocated_ptr = NULL; |
| @@ -734,9 +745,9 @@ static int alloc_try_nid_bottom_up_simple_check(void) · 8 unmodified lines |
| 734 | min_addr = memblock_start_of_DRAM() + SMP_CACHE_BYTES * 2; | 745 | min_addr = memblock_start_of_DRAM() + SMP_CACHE_BYTES * 2; |
| 735 | max_addr = min_addr + SZ_512; | 746 | max_addr = min_addr + SZ_512; |
| 736 | | 747 | |
| 737 | allocated_ptr = run_memblock_alloc_try_nid(size, SMP_CACHE_BYTES, | 748 | allocated_ptr = run_memblock_alloc_nid(size, SMP_CACHE_BYTES, |
| 738 | min_addr, max_addr, | 749 | min_addr, max_addr, |
| 739 | NUMA_NO_NODE); | 750 | NUMA_NO_NODE); |
| 740 | rgn_end = rgn->base + rgn->size; | 751 | rgn_end = rgn->base + rgn->size; |
| 741 | | 752 | |
| 742 | ASSERT_NE(allocated_ptr, NULL); | 753 | ASSERT_NE(allocated_ptr, NULL); |
| @@ -771,7 +782,7 @@ static int alloc_try_nid_bottom_up_simple_check(void) · 28 unmodified lines |
| 771 | * | 782 | * |
| 772 | * Expect to allocate an aligned region that ends before max_addr. | 783 | * Expect to allocate an aligned region that ends before max_addr. |
| 773 | */ | 784 | */ |
| 774 | static int alloc_try_nid_bottom_up_start_misaligned_check(void) | 785 | static int alloc_nid_bottom_up_start_misaligned_check(void) |
| 775 | { | 786 | { |
| 776 | struct memblock_region *rgn = &memblock.reserved.regions[0]; | 787 | struct memblock_region *rgn = &memblock.reserved.regions[0]; |
| 777 | void *allocated_ptr = NULL; | 788 | void *allocated_ptr = NULL; |
| @@ -787,9 +798,9 @@ static int alloc_try_nid_bottom_up_start_misaligned_check(void) · 9 unmodified lines |
| 787 | min_addr = memblock_start_of_DRAM() + misalign; | 798 | min_addr = memblock_start_of_DRAM() + misalign; |
| 788 | max_addr = min_addr + SZ_512; | 799 | max_addr = min_addr + SZ_512; |
| 789 | | 800 | |
| 790 | allocated_ptr = run_memblock_alloc_try_nid(size, SMP_CACHE_BYTES, | 801 | allocated_ptr = run_memblock_alloc_nid(size, SMP_CACHE_BYTES, |
| 791 | min_addr, max_addr, | 802 | min_addr, max_addr, |
| 792 | NUMA_NO_NODE); | 803 | NUMA_NO_NODE); |
| 793 | rgn_end = rgn->base + rgn->size; | 804 | rgn_end = rgn->base + rgn->size; |
| 794 | | 805 | |
| 795 | ASSERT_NE(allocated_ptr, NULL); | 806 | ASSERT_NE(allocated_ptr, NULL); |
| @@ -824,7 +835,7 @@ static int alloc_try_nid_bottom_up_start_misaligned_check(void) · 28 unmodified lines |
| 824 | * Expect to drop the lower limit and allocate a memory region which | 835 | * Expect to drop the lower limit and allocate a memory region which |
| 825 | * starts at the beginning of the available memory. | 836 | * starts at the beginning of the available memory. |
| 826 | */ | 837 | */ |
| 827 | static int alloc_try_nid_bottom_up_narrow_range_check(void) | 838 | static int alloc_nid_bottom_up_narrow_range_check(void) |
| 828 | { | 839 | { |
| 829 | struct memblock_region *rgn = &memblock.reserved.regions[0]; | 840 | struct memblock_region *rgn = &memblock.reserved.regions[0]; |
| 830 | void *allocated_ptr = NULL; | 841 | void *allocated_ptr = NULL; |
| @@ -838,9 +849,9 @@ static int alloc_try_nid_bottom_up_narrow_range_check(void) · 7 unmodified lines |
| 838 | min_addr = memblock_start_of_DRAM() + SZ_512; | 849 | min_addr = memblock_start_of_DRAM() + SZ_512; |
| 839 | max_addr = min_addr + SMP_CACHE_BYTES; | 850 | max_addr = min_addr + SMP_CACHE_BYTES; |
| 840 | | 851 | |
| 841 | allocated_ptr = run_memblock_alloc_try_nid(size, SMP_CACHE_BYTES, | 852 | allocated_ptr = run_memblock_alloc_nid(size, SMP_CACHE_BYTES, |
| 842 | min_addr, max_addr, | 853 | min_addr, max_addr, |
| 843 | NUMA_NO_NODE); | 854 | NUMA_NO_NODE); |
| 844 | | 855 | |
| 845 | ASSERT_NE(allocated_ptr, NULL); | 856 | ASSERT_NE(allocated_ptr, NULL); |
| 846 | assert_mem_content(allocated_ptr, size, alloc_nid_test_flags); | 857 | assert_mem_content(allocated_ptr, size, alloc_nid_test_flags); |
| @@ -873,7 +884,7 @@ static int alloc_try_nid_bottom_up_narrow_range_check(void) · 26 unmodified lines |
| 873 | * updated. The total size field gets updated. | 884 | * updated. The total size field gets updated. |
| 874 | */ | 885 | */ |
| 875 | | 886 | |
| 876 | static int alloc_try_nid_bottom_up_reserved_with_space_check(void) | 887 | static int alloc_nid_bottom_up_reserved_with_space_check(void) |
| 877 | { | 888 | { |
| 878 | struct memblock_region *rgn1 = &memblock.reserved.regions[1]; | 889 | struct memblock_region *rgn1 = &memblock.reserved.regions[1]; |
| 879 | struct memblock_region *rgn2 = &memblock.reserved.regions[0]; | 890 | struct memblock_region *rgn2 = &memblock.reserved.regions[0]; |
| @@ -901,9 +912,9 @@ static int alloc_try_nid_bottom_up_reserved_with_space_check(void) · 21 unmodified lines |
| 901 | memblock_reserve(r1.base, r1.size); | 912 | memblock_reserve(r1.base, r1.size); |
| 902 | memblock_reserve(r2.base, r2.size); | 913 | memblock_reserve(r2.base, r2.size); |
| 903 | | 914 | |
| 904 | allocated_ptr = run_memblock_alloc_try_nid(r3_size, SMP_CACHE_BYTES, | 915 | allocated_ptr = run_memblock_alloc_nid(r3_size, SMP_CACHE_BYTES, |
| 905 | min_addr, max_addr, | 916 | min_addr, max_addr, |
| 906 | NUMA_NO_NODE); | 917 | NUMA_NO_NODE); |
| 907 | | 918 | |
| 908 | ASSERT_NE(allocated_ptr, NULL); | 919 | ASSERT_NE(allocated_ptr, NULL); |
| 909 | assert_mem_content(allocated_ptr, r3_size, alloc_nid_test_flags); | 920 | assert_mem_content(allocated_ptr, r3_size, alloc_nid_test_flags); |
| @@ -942,7 +953,7 @@ static int alloc_try_nid_bottom_up_reserved_with_space_check(void) · 32 unmodified lines |
| 942 | * Other regions are not modified. | 953 | * Other regions are not modified. |
| 943 | */ | 954 | */ |
| 944 | | 955 | |
| 945 | static int alloc_try_nid_bottom_up_reserved_no_space_check(void) | 956 | static int alloc_nid_bottom_up_reserved_no_space_check(void) |
| 946 | { | 957 | { |
| 947 | struct memblock_region *rgn1 = &memblock.reserved.regions[2]; | 958 | struct memblock_region *rgn1 = &memblock.reserved.regions[2]; |
| 948 | struct memblock_region *rgn2 = &memblock.reserved.regions[1]; | 959 | struct memblock_region *rgn2 = &memblock.reserved.regions[1]; |
| @@ -971,9 +982,9 @@ static int alloc_try_nid_bottom_up_reserved_no_space_check(void) · 22 unmodified lines |
| 971 | memblock_reserve(r1.base, r1.size); | 982 | memblock_reserve(r1.base, r1.size); |
| 972 | memblock_reserve(r2.base, r2.size); | 983 | memblock_reserve(r2.base, r2.size); |
| 973 | | 984 | |
| 974 | allocated_ptr = run_memblock_alloc_try_nid(r3_size, SMP_CACHE_BYTES, | 985 | allocated_ptr = run_memblock_alloc_nid(r3_size, SMP_CACHE_BYTES, |
| 975 | min_addr, max_addr, | 986 | min_addr, max_addr, |
| 976 | NUMA_NO_NODE); | 987 | NUMA_NO_NODE); |
| 977 | | 988 | |
| 978 | ASSERT_NE(allocated_ptr, NULL); | 989 | ASSERT_NE(allocated_ptr, NULL); |
| 979 | assert_mem_content(allocated_ptr, r3_size, alloc_nid_test_flags); | 990 | assert_mem_content(allocated_ptr, r3_size, alloc_nid_test_flags); |
| @@ -1000,7 +1011,7 @@ static int alloc_try_nid_bottom_up_reserved_no_space_check(void) · 20 unmodified lines |
| 1000 | * bigger than the end address of the available memory. Expect to allocate | 1011 | * bigger than the end address of the available memory. Expect to allocate |
| 1001 | * a region that starts at the min_addr. | 1012 | * a region that starts at the min_addr. |
| 1002 | */ | 1013 | */ |
| 1003 | static int alloc_try_nid_bottom_up_cap_max_check(void) | 1014 | static int alloc_nid_bottom_up_cap_max_check(void) |
| 1004 | { | 1015 | { |
| 1005 | struct memblock_region *rgn = &memblock.reserved.regions[0]; | 1016 | struct memblock_region *rgn = &memblock.reserved.regions[0]; |
| 1006 | void *allocated_ptr = NULL; | 1017 | void *allocated_ptr = NULL; |
| @@ -1014,9 +1025,9 @@ static int alloc_try_nid_bottom_up_cap_max_check(void) · 7 unmodified lines |
| 1014 | min_addr = memblock_start_of_DRAM() + SZ_1K; | 1025 | min_addr = memblock_start_of_DRAM() + SZ_1K; |
| 1015 | max_addr = memblock_end_of_DRAM() + SZ_256; | 1026 | max_addr = memblock_end_of_DRAM() + SZ_256; |
| 1016 | | 1027 | |
| 1017 | allocated_ptr = run_memblock_alloc_try_nid(size, SMP_CACHE_BYTES, | 1028 | allocated_ptr = run_memblock_alloc_nid(size, SMP_CACHE_BYTES, |
| 1018 | min_addr, max_addr, | 1029 | min_addr, max_addr, |
| 1019 | NUMA_NO_NODE); | 1030 | NUMA_NO_NODE); |
| 1020 | | 1031 | |
| 1021 | ASSERT_NE(allocated_ptr, NULL); | 1032 | ASSERT_NE(allocated_ptr, NULL); |
| 1022 | assert_mem_content(allocated_ptr, size, alloc_nid_test_flags); | 1033 | assert_mem_content(allocated_ptr, size, alloc_nid_test_flags); |
| @@ -1037,7 +1048,7 @@ static int alloc_try_nid_bottom_up_cap_max_check(void) · 14 unmodified lines |
| 1037 | * smaller than the start address of the available memory. Expect to allocate | 1048 | * smaller than the start address of the available memory. Expect to allocate |
| 1038 | * a region at the beginning of the available memory. | 1049 | * a region at the beginning of the available memory. |
| 1039 | */ | 1050 | */ |
| 1040 | static int alloc_try_nid_bottom_up_cap_min_check(void) | 1051 | static int alloc_nid_bottom_up_cap_min_check(void) |
| 1041 | { | 1052 | { |
| 1042 | struct memblock_region *rgn = &memblock.reserved.regions[0]; | 1053 | struct memblock_region *rgn = &memblock.reserved.regions[0]; |
| 1043 | void *allocated_ptr = NULL; | 1054 | void *allocated_ptr = NULL; |
| @@ -1051,9 +1062,9 @@ static int alloc_try_nid_bottom_up_cap_min_check(void) · 7 unmodified lines |
| 1051 | min_addr = memblock_start_of_DRAM(); | 1062 | min_addr = memblock_start_of_DRAM(); |
| 1052 | max_addr = memblock_end_of_DRAM() - SZ_256; | 1063 | max_addr = memblock_end_of_DRAM() - SZ_256; |
| 1053 | | 1064 | |
| 1054 | allocated_ptr = run_memblock_alloc_try_nid(size, SMP_CACHE_BYTES, | 1065 | allocated_ptr = run_memblock_alloc_nid(size, SMP_CACHE_BYTES, |
| 1055 | min_addr, max_addr, | 1066 | min_addr, max_addr, |
| 1056 | NUMA_NO_NODE); | 1067 | NUMA_NO_NODE); |
| 1057 | | 1068 | |
| 1058 | ASSERT_NE(allocated_ptr, NULL); | 1069 | ASSERT_NE(allocated_ptr, NULL); |
| 1059 | assert_mem_content(allocated_ptr, size, alloc_nid_test_flags); | 1070 | assert_mem_content(allocated_ptr, size, alloc_nid_test_flags); |
| @@ -1070,133 +1081,133 @@ static int alloc_try_nid_bottom_up_cap_min_check(void) · 10 unmodified lines |
| 1070 | } | 1081 | } |
| 1071 | | 1082 | |
| 1072 | /* Test case wrappers for range tests */ | 1083 | /* Test case wrappers for range tests */ |
| 1073 | static int alloc_try_nid_simple_check(void) | 1084 | static int alloc_nid_simple_check(void) |
| 1074 | { | 1085 | { |
| 1075 | test_print("\tRunning %s...\n", __func__); | 1086 | test_print("\tRunning %s...\n", __func__); |
| 1076 | memblock_set_bottom_up(false); | 1087 | memblock_set_bottom_up(false); |
| 1077 | alloc_try_nid_top_down_simple_check(); | 1088 | alloc_nid_top_down_simple_check(); |
| 1078 | memblock_set_bottom_up(true); | 1089 | memblock_set_bottom_up(true); |
| 1079 | alloc_try_nid_bottom_up_simple_check(); | 1090 | alloc_nid_bottom_up_simple_check(); |
| 1080 | | 1091 | |
| 1081 | return 0; | 1092 | return 0; |
| 1082 | } | 1093 | } |
| 1083 | | 1094 | |
| 1084 | static int alloc_try_nid_misaligned_check(void) | 1095 | static int alloc_nid_misaligned_check(void) |
| 1085 | { | 1096 | { |
| 1086 | test_print("\tRunning %s...\n", __func__); | 1097 | test_print("\tRunning %s...\n", __func__); |
| 1087 | memblock_set_bottom_up(false); | 1098 | memblock_set_bottom_up(false); |
| 1088 | alloc_try_nid_top_down_end_misaligned_check(); | 1099 | alloc_nid_top_down_end_misaligned_check(); |
| 1089 | memblock_set_bottom_up(true); | 1100 | memblock_set_bottom_up(true); |
| 1090 | alloc_try_nid_bottom_up_start_misaligned_check(); | 1101 | alloc_nid_bottom_up_start_misaligned_check(); |
| 1091 | | 1102 | |
| 1092 | return 0; | 1103 | return 0; |
| 1093 | } | 1104 | } |
| 1094 | | 1105 | |
| 1095 | static int alloc_try_nid_narrow_range_check(void) | 1106 | static int alloc_nid_narrow_range_check(void) |
| 1096 | { | 1107 | { |
| 1097 | test_print("\tRunning %s...\n", __func__); | 1108 | test_print("\tRunning %s...\n", __func__); |
| 1098 | memblock_set_bottom_up(false); | 1109 | memblock_set_bottom_up(false); |
| 1099 | alloc_try_nid_top_down_narrow_range_check(); | 1110 | alloc_nid_top_down_narrow_range_check(); |
| 1100 | memblock_set_bottom_up(true); | 1111 | memblock_set_bottom_up(true); |
| 1101 | alloc_try_nid_bottom_up_narrow_range_check(); | 1112 | alloc_nid_bottom_up_narrow_range_check(); |
| 1102 | | 1113 | |
| 1103 | return 0; | 1114 | return 0; |
| 1104 | } | 1115 | } |
| 1105 | | 1116 | |
| 1106 | static int alloc_try_nid_reserved_with_space_check(void) | 1117 | static int alloc_nid_reserved_with_space_check(void) |
| 1107 | { | 1118 | { |
| 1108 | test_print("\tRunning %s...\n", __func__); | 1119 | test_print("\tRunning %s...\n", __func__); |
| 1109 | memblock_set_bottom_up(false); | 1120 | memblock_set_bottom_up(false); |
| 1110 | alloc_try_nid_top_down_reserved_with_space_check(); | 1121 | alloc_nid_top_down_reserved_with_space_check(); |
| 1111 | memblock_set_bottom_up(true); | 1122 | memblock_set_bottom_up(true); |
| 1112 | alloc_try_nid_bottom_up_reserved_with_space_check(); | 1123 | alloc_nid_bottom_up_reserved_with_space_check(); |
| 1113 | | 1124 | |
| 1114 | return 0; | 1125 | return 0; |
| 1115 | } | 1126 | } |
| 1116 | | 1127 | |
| 1117 | static int alloc_try_nid_reserved_no_space_check(void) | 1128 | static int alloc_nid_reserved_no_space_check(void) |
| 1118 | { | 1129 | { |
| 1119 | test_print("\tRunning %s...\n", __func__); | 1130 | test_print("\tRunning %s...\n", __func__); |
| 1120 | memblock_set_bottom_up(false); | 1131 | memblock_set_bottom_up(false); |
| 1121 | alloc_try_nid_top_down_reserved_no_space_check(); | 1132 | alloc_nid_top_down_reserved_no_space_check(); |
| 1122 | memblock_set_bottom_up(true); | 1133 | memblock_set_bottom_up(true); |
| 1123 | alloc_try_nid_bottom_up_reserved_no_space_check(); | 1134 | alloc_nid_bottom_up_reserved_no_space_check(); |
| 1124 | | 1135 | |
| 1125 | return 0; | 1136 | return 0; |
| 1126 | } | 1137 | } |
| 1127 | | 1138 | |
| 1128 | static int alloc_try_nid_cap_max_check(void) | 1139 | static int alloc_nid_cap_max_check(void) |
| 1129 | { | 1140 | { |
| 1130 | test_print("\tRunning %s...\n", __func__); | 1141 | test_print("\tRunning %s...\n", __func__); |
| 1131 | memblock_set_bottom_up(false); | 1142 | memblock_set_bottom_up(false); |
| 1132 | alloc_try_nid_top_down_cap_max_check(); | 1143 | alloc_nid_top_down_cap_max_check(); |
| 1133 | memblock_set_bottom_up(true); | 1144 | memblock_set_bottom_up(true); |
| 1134 | alloc_try_nid_bottom_up_cap_max_check(); | 1145 | alloc_nid_bottom_up_cap_max_check(); |
| 1135 | | 1146 | |
| 1136 | return 0; | 1147 | return 0; |
| 1137 | } | 1148 | } |
| 1138 | | 1149 | |
| 1139 | static int alloc_try_nid_cap_min_check(void) | 1150 | static int alloc_nid_cap_min_check(void) |
| 1140 | { | 1151 | { |
| 1141 | test_print("\tRunning %s...\n", __func__); | 1152 | test_print("\tRunning %s...\n", __func__); |
| 1142 | memblock_set_bottom_up(false); | 1153 | memblock_set_bottom_up(false); |
| 1143 | alloc_try_nid_top_down_cap_min_check(); | 1154 | alloc_nid_top_down_cap_min_check(); |
| 1144 | memblock_set_bottom_up(true); | 1155 | memblock_set_bottom_up(true); |
| 1145 | alloc_try_nid_bottom_up_cap_min_check(); | 1156 | alloc_nid_bottom_up_cap_min_check(); |
| 1146 | | 1157 | |
| 1147 | return 0; | 1158 | return 0; |
| 1148 | } | 1159 | } |
| 1149 | | 1160 | |
| 1150 | static int alloc_try_nid_min_reserved_check(void) | 1161 | static int alloc_nid_min_reserved_check(void) |
| 1151 | { | 1162 | { |
| 1152 | test_print("\tRunning %s...\n", __func__); | 1163 | test_print("\tRunning %s...\n", __func__); |
| 1153 | run_top_down(alloc_try_nid_min_reserved_generic_check); | 1164 | run_top_down(alloc_nid_min_reserved_generic_check); |
| 1154 | run_bottom_up(alloc_try_nid_min_reserved_generic_check); | 1165 | run_bottom_up(alloc_nid_min_reserved_generic_check); |
| 1155 | | 1166 | |
| 1156 | return 0; | 1167 | return 0; |
| 1157 | } | 1168 | } |
| 1158 | | 1169 | |
| 1159 | static int alloc_try_nid_max_reserved_check(void) | 1170 | static int alloc_nid_max_reserved_check(void) |
| 1160 | { | 1171 | { |
| 1161 | test_print("\tRunning %s...\n", __func__); | 1172 | test_print("\tRunning %s...\n", __func__); |
| 1162 | run_top_down(alloc_try_nid_max_reserved_generic_check); | 1173 | run_top_down(alloc_nid_max_reserved_generic_check); |
| 1163 | run_bottom_up(alloc_try_nid_max_reserved_generic_check); | 1174 | run_bottom_up(alloc_nid_max_reserved_generic_check); |
| 1164 | | 1175 | |
| 1165 | return 0; | 1176 | return 0; |
| 1166 | } | 1177 | } |
| 1167 | | 1178 | |
| 1168 | static int alloc_try_nid_exact_address_check(void) | 1179 | static int alloc_nid_exact_address_check(void) |
| 1169 | { | 1180 | { |
| 1170 | test_print("\tRunning %s...\n", __func__); | 1181 | test_print("\tRunning %s...\n", __func__); |
| 1171 | run_top_down(alloc_try_nid_exact_address_generic_check); | 1182 | run_top_down(alloc_nid_exact_address_generic_check); |
| 1172 | run_bottom_up(alloc_try_nid_exact_address_generic_check); | 1183 | run_bottom_up(alloc_nid_exact_address_generic_check); |
| 1173 | | 1184 | |
| 1174 | return 0; | 1185 | return 0; |
| 1175 | } | 1186 | } |
| 1176 | | 1187 | |
| 1177 | static int alloc_try_nid_reserved_full_merge_check(void) | 1188 | static int alloc_nid_reserved_full_merge_check(void) |
| 1178 | { | 1189 | { |
| 1179 | test_print("\tRunning %s...\n", __func__); | 1190 | test_print("\tRunning %s...\n", __func__); |
| 1180 | run_top_down(alloc_try_nid_reserved_full_merge_generic_check); | 1191 | run_top_down(alloc_nid_reserved_full_merge_generic_check); |
| 1181 | run_bottom_up(alloc_try_nid_reserved_full_merge_generic_check); | 1192 | run_bottom_up(alloc_nid_reserved_full_merge_generic_check); |
| 1182 | | 1193 | |
| 1183 | return 0; | 1194 | return 0; |
| 1184 | } | 1195 | } |
| 1185 | | 1196 | |
| 1186 | static int alloc_try_nid_reserved_all_check(void) | 1197 | static int alloc_nid_reserved_all_check(void) |
| 1187 | { | 1198 | { |
| 1188 | test_print("\tRunning %s...\n", __func__); | 1199 | test_print("\tRunning %s...\n", __func__); |
| 1189 | run_top_down(alloc_try_nid_reserved_all_generic_check); | 1200 | run_top_down(alloc_nid_reserved_all_generic_check); |
| 1190 | run_bottom_up(alloc_try_nid_reserved_all_generic_check); | 1201 | run_bottom_up(alloc_nid_reserved_all_generic_check); |
| 1191 | | 1202 | |
| 1192 | return 0; | 1203 | return 0; |
| 1193 | } | 1204 | } |
| 1194 | | 1205 | |
| 1195 | static int alloc_try_nid_low_max_check(void) | 1206 | static int alloc_nid_low_max_check(void) |
| 1196 | { | 1207 | { |
| 1197 | test_print("\tRunning %s...\n", __func__); | 1208 | test_print("\tRunning %s...\n", __func__); |
| 1198 | run_top_down(alloc_try_nid_low_max_generic_check); | 1209 | run_top_down(alloc_nid_low_max_generic_check); |
| 1199 | run_bottom_up(alloc_try_nid_low_max_generic_check); | 1210 | run_bottom_up(alloc_nid_low_max_generic_check); |
| 1200 | | 1211 | |
| 1201 | return 0; | 1212 | return 0; |
| 1202 | } | 1213 | } |
| @@ -1204,22 +1215,22 @@ static int alloc_try_nid_low_max_check(void) · 1 unmodified line |
| 1204 | static int memblock_alloc_nid_range_checks(void) | 1215 | static int memblock_alloc_nid_range_checks(void) |
| 1205 | { | 1216 | { |
| 1206 | test_print("Running %s range tests...\n", | 1217 | test_print("Running %s range tests...\n", |
| 1207 | get_memblock_alloc_try_nid_name(alloc_nid_test_flags)); | 1218 | get_memblock_alloc_nid_name(alloc_nid_test_flags)); |
| 1208 | | 1219 | |
| 1209 | alloc_try_nid_simple_check(); | 1220 | alloc_nid_simple_check(); |
| 1210 | alloc_try_nid_misaligned_check(); | 1221 | alloc_nid_misaligned_check(); |
| 1211 | alloc_try_nid_narrow_range_check(); | 1222 | alloc_nid_narrow_range_check(); |
| 1212 | alloc_try_nid_reserved_with_space_check(); | 1223 | alloc_nid_reserved_with_space_check(); |
| 1213 | alloc_try_nid_reserved_no_space_check(); | 1224 | alloc_nid_reserved_no_space_check(); |
| 1214 | alloc_try_nid_cap_max_check(); | 1225 | alloc_nid_cap_max_check(); |
| 1215 | alloc_try_nid_cap_min_check(); | 1226 | alloc_nid_cap_min_check(); |
| 1216 | | 1227 | |
| 1217 | alloc_try_nid_min_reserved_check(); | 1228 | alloc_nid_min_reserved_check(); |
| 1218 | alloc_try_nid_max_reserved_check(); | 1229 | alloc_nid_max_reserved_check(); |
| 1219 | alloc_try_nid_exact_address_check(); | 1230 | alloc_nid_exact_address_check(); |
| 1220 | alloc_try_nid_reserved_full_merge_check(); | 1231 | alloc_nid_reserved_full_merge_check(); |
| 1221 | alloc_try_nid_reserved_all_check(); | 1232 | alloc_nid_reserved_all_check(); |
| 1222 | alloc_try_nid_low_max_check(); | 1233 | alloc_nid_low_max_check(); |
| 1223 | | 1234 | |
| 1224 | return 0; | 1235 | return 0; |
| 1225 | } | 1236 | } |
| @@ -1229,7 +1240,7 @@ static int memblock_alloc_nid_range_checks(void) · 3 unmodified lines |
| 1229 | * has enough memory to allocate a region of the requested size. | 1240 | * has enough memory to allocate a region of the requested size. |
| 1230 | * Expect to allocate an aligned region at the end of the requested node. | 1241 | * Expect to allocate an aligned region at the end of the requested node. |
| 1231 | */ | 1242 | */ |
| 1232 | static int alloc_try_nid_top_down_numa_simple_check(void) | 1243 | static int alloc_nid_top_down_numa_simple_check(void) |
| 1233 | { | 1244 | { |
| 1234 | int nid_req = 3; | 1245 | int nid_req = 3; |
| 1235 | struct memblock_region *new_rgn = &memblock.reserved.regions[0]; | 1246 | struct memblock_region *new_rgn = &memblock.reserved.regions[0]; |
| @@ -1247,8 +1258,8 @@ static int alloc_try_nid_top_down_numa_simple_check(void) · 11 unmodified lines |
| 1247 | min_addr = memblock_start_of_DRAM(); | 1258 | min_addr = memblock_start_of_DRAM(); |
| 1248 | max_addr = memblock_end_of_DRAM(); | 1259 | max_addr = memblock_end_of_DRAM(); |
| 1249 | | 1260 | |
| 1250 | allocated_ptr = run_memblock_alloc_try_nid(size, SMP_CACHE_BYTES, | 1261 | allocated_ptr = run_memblock_alloc_nid(size, SMP_CACHE_BYTES, |
| 1251 | min_addr, max_addr, nid_req); | 1262 | min_addr, max_addr, nid_req); |
| 1252 | | 1263 | |
| 1253 | ASSERT_NE(allocated_ptr, NULL); | 1264 | ASSERT_NE(allocated_ptr, NULL); |
| 1254 | assert_mem_content(allocated_ptr, size, alloc_nid_test_flags); | 1265 | assert_mem_content(allocated_ptr, size, alloc_nid_test_flags); |
| @@ -1280,7 +1291,7 @@ static int alloc_try_nid_top_down_numa_simple_check(void) · 25 unmodified lines |
| 1280 | * Expect to allocate an aligned region at the end of the last node that has | 1291 | * Expect to allocate an aligned region at the end of the last node that has |
| 1281 | * enough memory (in this case, nid = 6) after falling back to NUMA_NO_NODE. | 1292 | * enough memory (in this case, nid = 6) after falling back to NUMA_NO_NODE. |
| 1282 | */ | 1293 | */ |
| 1283 | static int alloc_try_nid_top_down_numa_small_node_check(void) | 1294 | static int alloc_nid_top_down_numa_small_node_check(void) |
| 1284 | { | 1295 | { |
| 1285 | int nid_req = 1; | 1296 | int nid_req = 1; |
| 1286 | int nid_exp = 6; | 1297 | int nid_exp = 6; |
| @@ -1299,8 +1310,8 @@ static int alloc_try_nid_top_down_numa_small_node_check(void) · 12 unmodified lines |
| 1299 | min_addr = memblock_start_of_DRAM(); | 1310 | min_addr = memblock_start_of_DRAM(); |
| 1300 | max_addr = memblock_end_of_DRAM(); | 1311 | max_addr = memblock_end_of_DRAM(); |
| 1301 | | 1312 | |
| 1302 | allocated_ptr = run_memblock_alloc_try_nid(size, SMP_CACHE_BYTES, | 1313 | allocated_ptr = run_memblock_alloc_nid(size, SMP_CACHE_BYTES, |
| 1303 | min_addr, max_addr, nid_req); | 1314 | min_addr, max_addr, nid_req); |
| 1304 | | 1315 | |
| 1305 | ASSERT_NE(allocated_ptr, NULL); | 1316 | ASSERT_NE(allocated_ptr, NULL); |
| 1306 | assert_mem_content(allocated_ptr, size, alloc_nid_test_flags); | 1317 | assert_mem_content(allocated_ptr, size, alloc_nid_test_flags); |
| @@ -1333,7 +1344,7 @@ static int alloc_try_nid_top_down_numa_small_node_check(void) · 26 unmodified lines |
| 1333 | * large enough and has enough unreserved memory (in this case, nid = 6) after | 1344 | * large enough and has enough unreserved memory (in this case, nid = 6) after |
| 1334 | * falling back to NUMA_NO_NODE. The region count and total size get updated. | 1345 | * falling back to NUMA_NO_NODE. The region count and total size get updated. |
| 1335 | */ | 1346 | */ |
| 1336 | static int alloc_try_nid_top_down_numa_node_reserved_check(void) | 1347 | static int alloc_nid_top_down_numa_node_reserved_check(void) |
| 1337 | { | 1348 | { |
| 1338 | int nid_req = 2; | 1349 | int nid_req = 2; |
| 1339 | int nid_exp = 6; | 1350 | int nid_exp = 6; |
| @@ -1353,8 +1364,8 @@ static int alloc_try_nid_top_down_numa_node_reserved_check(void) · 13 unmodified lines |
| 1353 | max_addr = memblock_end_of_DRAM(); | 1364 | max_addr = memblock_end_of_DRAM(); |
| 1354 | | 1365 | |
| 1355 | memblock_reserve(req_node->base, req_node->size); | 1366 | memblock_reserve(req_node->base, req_node->size); |
| 1356 | allocated_ptr = run_memblock_alloc_try_nid(size, SMP_CACHE_BYTES, | 1367 | allocated_ptr = run_memblock_alloc_nid(size, SMP_CACHE_BYTES, |
| 1357 | min_addr, max_addr, nid_req); | 1368 | min_addr, max_addr, nid_req); |
| 1358 | | 1369 | |
| 1359 | ASSERT_NE(allocated_ptr, NULL); | 1370 | ASSERT_NE(allocated_ptr, NULL); |
| 1360 | assert_mem_content(allocated_ptr, size, alloc_nid_test_flags); | 1371 | assert_mem_content(allocated_ptr, size, alloc_nid_test_flags); |
| @@ -1386,7 +1397,7 @@ static int alloc_try_nid_top_down_numa_node_reserved_check(void) · 25 unmodified lines |
| 1386 | * Expect to allocate an aligned region at the end of the requested node. The | 1397 | * Expect to allocate an aligned region at the end of the requested node. The |
| 1387 | * region count and total size get updated. | 1398 | * region count and total size get updated. |
| 1388 | */ | 1399 | */ |
| 1389 | static int alloc_try_nid_top_down_numa_part_reserved_check(void) | 1400 | static int alloc_nid_top_down_numa_part_reserved_check(void) |
| 1390 | { | 1401 | { |
| 1391 | int nid_req = 4; | 1402 | int nid_req = 4; |
| 1392 | struct memblock_region *new_rgn = &memblock.reserved.regions[1]; | 1403 | struct memblock_region *new_rgn = &memblock.reserved.regions[1]; |
| @@ -1408,8 +1419,8 @@ static int alloc_try_nid_top_down_numa_part_reserved_check(void) · 15 unmodified lines |
| 1408 | max_addr = memblock_end_of_DRAM(); | 1419 | max_addr = memblock_end_of_DRAM(); |
| 1409 | | 1420 | |
| 1410 | memblock_reserve(r1.base, r1.size); | 1421 | memblock_reserve(r1.base, r1.size); |
| 1411 | allocated_ptr = run_memblock_alloc_try_nid(size, SMP_CACHE_BYTES, | 1422 | allocated_ptr = run_memblock_alloc_nid(size, SMP_CACHE_BYTES, |
| 1412 | min_addr, max_addr, nid_req); | 1423 | min_addr, max_addr, nid_req); |
| 1413 | | 1424 | |
| 1414 | ASSERT_NE(allocated_ptr, NULL); | 1425 | ASSERT_NE(allocated_ptr, NULL); |
| 1415 | assert_mem_content(allocated_ptr, size, alloc_nid_test_flags); | 1426 | assert_mem_content(allocated_ptr, size, alloc_nid_test_flags); |
| @@ -1444,7 +1455,7 @@ static int alloc_try_nid_top_down_numa_part_reserved_check(void) · 28 unmodified lines |
| 1444 | * nid = NUMA_NODES - 1) after falling back to NUMA_NO_NODE. The region count | 1455 | * nid = NUMA_NODES - 1) after falling back to NUMA_NO_NODE. The region count |
| 1445 | * and total size get updated. | 1456 | * and total size get updated. |
| 1446 | */ | 1457 | */ |
| 1447 | static int alloc_try_nid_top_down_numa_part_reserved_fallback_check(void) | 1458 | static int alloc_nid_top_down_numa_part_reserved_fallback_check(void) |
| 1448 | { | 1459 | { |
| 1449 | int nid_req = 4; | 1460 | int nid_req = 4; |
| 1450 | int nid_exp = NUMA_NODES - 1; | 1461 | int nid_exp = NUMA_NODES - 1; |
| @@ -1469,8 +1480,8 @@ static int alloc_try_nid_top_down_numa_part_reserved_fallback_check(void) · 18 unmodified lines |
| 1469 | max_addr = memblock_end_of_DRAM(); | 1480 | max_addr = memblock_end_of_DRAM(); |
| 1470 | | 1481 | |
| 1471 | memblock_reserve(r1.base, r1.size); | 1482 | memblock_reserve(r1.base, r1.size); |
| 1472 | allocated_ptr = run_memblock_alloc_try_nid(size, SMP_CACHE_BYTES, | 1483 | allocated_ptr = run_memblock_alloc_nid(size, SMP_CACHE_BYTES, |
| 1473 | min_addr, max_addr, nid_req); | 1484 | min_addr, max_addr, nid_req); |
| 1474 | | 1485 | |
| 1475 | ASSERT_NE(allocated_ptr, NULL); | 1486 | ASSERT_NE(allocated_ptr, NULL); |
| 1476 | assert_mem_content(allocated_ptr, size, alloc_nid_test_flags); | 1487 | assert_mem_content(allocated_ptr, size, alloc_nid_test_flags); |
| @@ -1507,7 +1518,7 @@ static int alloc_try_nid_top_down_numa_part_reserved_fallback_check(void) · 30 unmodified lines |
| 1507 | * Expect to drop the lower limit and allocate a memory region that ends at | 1518 | * Expect to drop the lower limit and allocate a memory region that ends at |
| 1508 | * the end of the requested node. | 1519 | * the end of the requested node. |
| 1509 | */ | 1520 | */ |
| 1510 | static int alloc_try_nid_top_down_numa_split_range_low_check(void) | 1521 | static int alloc_nid_top_down_numa_split_range_low_check(void) |
| 1511 | { | 1522 | { |
| 1512 | int nid_req = 2; | 1523 | int nid_req = 2; |
| 1513 | struct memblock_region *new_rgn = &memblock.reserved.regions[0]; | 1524 | struct memblock_region *new_rgn = &memblock.reserved.regions[0]; |
| @@ -1525,8 +1536,8 @@ static int alloc_try_nid_top_down_numa_split_range_low_check(void) · 11 unmodified lines |
| 1525 | min_addr = req_node_end - SZ_256; | 1536 | min_addr = req_node_end - SZ_256; |
| 1526 | max_addr = min_addr + size; | 1537 | max_addr = min_addr + size; |
| 1527 | | 1538 | |
| 1528 | allocated_ptr = run_memblock_alloc_try_nid(size, SMP_CACHE_BYTES, | 1539 | allocated_ptr = run_memblock_alloc_nid(size, SMP_CACHE_BYTES, |
| 1529 | min_addr, max_addr, nid_req); | 1540 | min_addr, max_addr, nid_req); |
| 1530 | | 1541 | |
| 1531 | ASSERT_NE(allocated_ptr, NULL); | 1542 | ASSERT_NE(allocated_ptr, NULL); |
| 1532 | assert_mem_content(allocated_ptr, size, alloc_nid_test_flags); | 1543 | assert_mem_content(allocated_ptr, size, alloc_nid_test_flags); |
| @@ -1563,7 +1574,7 @@ static int alloc_try_nid_top_down_numa_split_range_low_check(void) · 30 unmodified lines |
| 1563 | * Expect to drop the lower limit and allocate a memory region that | 1574 | * Expect to drop the lower limit and allocate a memory region that |
| 1564 | * ends at the end of the first node that overlaps with the range. | 1575 | * ends at the end of the first node that overlaps with the range. |
| 1565 | */ | 1576 | */ |
| 1566 | static int alloc_try_nid_top_down_numa_split_range_high_check(void) | 1577 | static int alloc_nid_top_down_numa_split_range_high_check(void) |
| 1567 | { | 1578 | { |
| 1568 | int nid_req = 3; | 1579 | int nid_req = 3; |
| 1569 | int nid_exp = nid_req - 1; | 1580 | int nid_exp = nid_req - 1; |
| @@ -1582,8 +1593,8 @@ static int alloc_try_nid_top_down_numa_split_range_high_check(void) · 12 unmodified lines |
| 1582 | min_addr = exp_node_end - SZ_256; | 1593 | min_addr = exp_node_end - SZ_256; |
| 1583 | max_addr = min_addr + size; | 1594 | max_addr = min_addr + size; |
| 1584 | | 1595 | |
| 1585 | allocated_ptr = run_memblock_alloc_try_nid(size, SMP_CACHE_BYTES, | 1596 | allocated_ptr = run_memblock_alloc_nid(size, SMP_CACHE_BYTES, |
| 1586 | min_addr, max_addr, nid_req); | 1597 | min_addr, max_addr, nid_req); |
| 1587 | | 1598 | |
| 1588 | ASSERT_NE(allocated_ptr, NULL); | 1599 | ASSERT_NE(allocated_ptr, NULL); |
| 1589 | assert_mem_content(allocated_ptr, size, alloc_nid_test_flags); | 1600 | assert_mem_content(allocated_ptr, size, alloc_nid_test_flags); |
| @@ -1620,7 +1631,7 @@ static int alloc_try_nid_top_down_numa_split_range_high_check(void) · 30 unmodified lines |
| 1620 | * Expect to drop the lower limit and allocate a memory region that ends at | 1631 | * Expect to drop the lower limit and allocate a memory region that ends at |
| 1621 | * the end of the requested node. | 1632 | * the end of the requested node. |
| 1622 | */ | 1633 | */ |
| 1623 | static int alloc_try_nid_top_down_numa_no_overlap_split_check(void) | 1634 | static int alloc_nid_top_down_numa_no_overlap_split_check(void) |
| 1624 | { | 1635 | { |
| 1625 | int nid_req = 2; | 1636 | int nid_req = 2; |
| 1626 | struct memblock_region *new_rgn = &memblock.reserved.regions[0]; | 1637 | struct memblock_region *new_rgn = &memblock.reserved.regions[0]; |
| @@ -1638,8 +1649,8 @@ static int alloc_try_nid_top_down_numa_no_overlap_split_check(void) · 11 unmodified lines |
| 1638 | min_addr = node2->base - SZ_256; | 1649 | min_addr = node2->base - SZ_256; |
| 1639 | max_addr = min_addr + size; | 1650 | max_addr = min_addr + size; |
| 1640 | | 1651 | |
| 1641 | allocated_ptr = run_memblock_alloc_try_nid(size, SMP_CACHE_BYTES, | 1652 | allocated_ptr = run_memblock_alloc_nid(size, SMP_CACHE_BYTES, |
| 1642 | min_addr, max_addr, nid_req); | 1653 | min_addr, max_addr, nid_req); |
| 1643 | | 1654 | |
| 1644 | ASSERT_NE(allocated_ptr, NULL); | 1655 | ASSERT_NE(allocated_ptr, NULL); |
| 1645 | assert_mem_content(allocated_ptr, size, alloc_nid_test_flags); | 1656 | assert_mem_content(allocated_ptr, size, alloc_nid_test_flags); |
| @@ -1677,7 +1688,7 @@ static int alloc_try_nid_top_down_numa_no_overlap_split_check(void) · 31 unmodified lines |
| 1677 | * Expect to allocate a memory region at the end of the final node in | 1688 | * Expect to allocate a memory region at the end of the final node in |
| 1678 | * the range after falling back to NUMA_NO_NODE. | 1689 | * the range after falling back to NUMA_NO_NODE. |
| 1679 | */ | 1690 | */ |
| 1680 | static int alloc_try_nid_top_down_numa_no_overlap_low_check(void) | 1691 | static int alloc_nid_top_down_numa_no_overlap_low_check(void) |
| 1681 | { | 1692 | { |
| 1682 | int nid_req = 0; | 1693 | int nid_req = 0; |
| 1683 | struct memblock_region *new_rgn = &memblock.reserved.regions[0]; | 1694 | struct memblock_region *new_rgn = &memblock.reserved.regions[0]; |
| @@ -1694,8 +1705,8 @@ static int alloc_try_nid_top_down_numa_no_overlap_low_check(void) · 10 unmodified lines |
| 1694 | min_addr = min_node->base; | 1705 | min_addr = min_node->base; |
| 1695 | max_addr = region_end(max_node); | 1706 | max_addr = region_end(max_node); |
| 1696 | | 1707 | |
| 1697 | allocated_ptr = run_memblock_alloc_try_nid(size, SMP_CACHE_BYTES, | 1708 | allocated_ptr = run_memblock_alloc_nid(size, SMP_CACHE_BYTES, |
| 1698 | min_addr, max_addr, nid_req); | 1709 | min_addr, max_addr, nid_req); |
| 1699 | | 1710 | |
| 1700 | ASSERT_NE(allocated_ptr, NULL); | 1711 | ASSERT_NE(allocated_ptr, NULL); |
| 1701 | assert_mem_content(allocated_ptr, size, alloc_nid_test_flags); | 1712 | assert_mem_content(allocated_ptr, size, alloc_nid_test_flags); |
| @@ -1733,7 +1744,7 @@ static int alloc_try_nid_top_down_numa_no_overlap_low_check(void) · 31 unmodified lines |
| 1733 | * Expect to allocate a memory region at the end of the final node in | 1744 | * Expect to allocate a memory region at the end of the final node in |
| 1734 | * the range after falling back to NUMA_NO_NODE. | 1745 | * the range after falling back to NUMA_NO_NODE. |
| 1735 | */ | 1746 | */ |
| 1736 | static int alloc_try_nid_top_down_numa_no_overlap_high_check(void) | 1747 | static int alloc_nid_top_down_numa_no_overlap_high_check(void) |
| 1737 | { | 1748 | { |
| 1738 | int nid_req = 7; | 1749 | int nid_req = 7; |
| 1739 | struct memblock_region *new_rgn = &memblock.reserved.regions[0]; | 1750 | struct memblock_region *new_rgn = &memblock.reserved.regions[0]; |
| @@ -1750,8 +1761,8 @@ static int alloc_try_nid_top_down_numa_no_overlap_high_check(void) · 10 unmodified lines |
| 1750 | min_addr = min_node->base; | 1761 | min_addr = min_node->base; |
| 1751 | max_addr = region_end(max_node); | 1762 | max_addr = region_end(max_node); |
| 1752 | | 1763 | |
| 1753 | allocated_ptr = run_memblock_alloc_try_nid(size, SMP_CACHE_BYTES, | 1764 | allocated_ptr = run_memblock_alloc_nid(size, SMP_CACHE_BYTES, |
| 1754 | min_addr, max_addr, nid_req); | 1765 | min_addr, max_addr, nid_req); |
| 1755 | | 1766 | |
| 1756 | ASSERT_NE(allocated_ptr, NULL); | 1767 | ASSERT_NE(allocated_ptr, NULL); |
| 1757 | assert_mem_content(allocated_ptr, size, alloc_nid_test_flags); | 1768 | assert_mem_content(allocated_ptr, size, alloc_nid_test_flags); |
| @@ -1773,7 +1784,7 @@ static int alloc_try_nid_top_down_numa_no_overlap_high_check(void) · 15 unmodified lines |
| 1773 | * has enough memory to allocate a region of the requested size. | 1784 | * has enough memory to allocate a region of the requested size. |
| 1774 | * Expect to allocate an aligned region at the beginning of the requested node. | 1785 | * Expect to allocate an aligned region at the beginning of the requested node. |
| 1775 | */ | 1786 | */ |
| 1776 | static int alloc_try_nid_bottom_up_numa_simple_check(void) | 1787 | static int alloc_nid_bottom_up_numa_simple_check(void) |
| 1777 | { | 1788 | { |
| 1778 | int nid_req = 3; | 1789 | int nid_req = 3; |
| 1779 | struct memblock_region *new_rgn = &memblock.reserved.regions[0]; | 1790 | struct memblock_region *new_rgn = &memblock.reserved.regions[0]; |
| @@ -1791,8 +1802,8 @@ static int alloc_try_nid_bottom_up_numa_simple_check(void) · 11 unmodified lines |
| 1791 | min_addr = memblock_start_of_DRAM(); | 1802 | min_addr = memblock_start_of_DRAM(); |
| 1792 | max_addr = memblock_end_of_DRAM(); | 1803 | max_addr = memblock_end_of_DRAM(); |
| 1793 | | 1804 | |
| 1794 | allocated_ptr = run_memblock_alloc_try_nid(size, SMP_CACHE_BYTES, | 1805 | allocated_ptr = run_memblock_alloc_nid(size, SMP_CACHE_BYTES, |
| 1795 | min_addr, max_addr, nid_req); | 1806 | min_addr, max_addr, nid_req); |
| 1796 | | 1807 | |
| 1797 | ASSERT_NE(allocated_ptr, NULL); | 1808 | ASSERT_NE(allocated_ptr, NULL); |
| 1798 | assert_mem_content(allocated_ptr, size, alloc_nid_test_flags); | 1809 | assert_mem_content(allocated_ptr, size, alloc_nid_test_flags); |
| @@ -1824,7 +1835,7 @@ static int alloc_try_nid_bottom_up_numa_simple_check(void) · 25 unmodified lines |
| 1824 | * Expect to allocate an aligned region at the beginning of the first node that | 1835 | * Expect to allocate an aligned region at the beginning of the first node that |
| 1825 | * has enough memory (in this case, nid = 0) after falling back to NUMA_NO_NODE. | 1836 | * has enough memory (in this case, nid = 0) after falling back to NUMA_NO_NODE. |
| 1826 | */ | 1837 | */ |
| 1827 | static int alloc_try_nid_bottom_up_numa_small_node_check(void) | 1838 | static int alloc_nid_bottom_up_numa_small_node_check(void) |
| 1828 | { | 1839 | { |
| 1829 | int nid_req = 1; | 1840 | int nid_req = 1; |
| 1830 | int nid_exp = 0; | 1841 | int nid_exp = 0; |
| @@ -1843,8 +1854,8 @@ static int alloc_try_nid_bottom_up_numa_small_node_check(void) · 12 unmodified lines |
| 1843 | min_addr = memblock_start_of_DRAM(); | 1854 | min_addr = memblock_start_of_DRAM(); |
| 1844 | max_addr = memblock_end_of_DRAM(); | 1855 | max_addr = memblock_end_of_DRAM(); |
| 1845 | | 1856 | |
| 1846 | allocated_ptr = run_memblock_alloc_try_nid(size, SMP_CACHE_BYTES, | 1857 | allocated_ptr = run_memblock_alloc_nid(size, SMP_CACHE_BYTES, |
| 1847 | min_addr, max_addr, nid_req); | 1858 | min_addr, max_addr, nid_req); |
| 1848 | | 1859 | |
| 1849 | ASSERT_NE(allocated_ptr, NULL); | 1860 | ASSERT_NE(allocated_ptr, NULL); |
| 1850 | assert_mem_content(allocated_ptr, size, alloc_nid_test_flags); | 1861 | assert_mem_content(allocated_ptr, size, alloc_nid_test_flags); |
| @@ -1878,7 +1889,7 @@ static int alloc_try_nid_bottom_up_numa_small_node_check(void) · 27 unmodified lines |
| 1878 | * after falling back to NUMA_NO_NODE. The region count and total size get | 1889 | * after falling back to NUMA_NO_NODE. The region count and total size get |
| 1879 | * updated. | 1890 | * updated. |
| 1880 | */ | 1891 | */ |
| 1881 | static int alloc_try_nid_bottom_up_numa_node_reserved_check(void) | 1892 | static int alloc_nid_bottom_up_numa_node_reserved_check(void) |
| 1882 | { | 1893 | { |
| 1883 | int nid_req = 2; | 1894 | int nid_req = 2; |
| 1884 | int nid_exp = 0; | 1895 | int nid_exp = 0; |
| @@ -1898,8 +1909,8 @@ static int alloc_try_nid_bottom_up_numa_node_reserved_check(void) · 13 unmodified lines |
| 1898 | max_addr = memblock_end_of_DRAM(); | 1909 | max_addr = memblock_end_of_DRAM(); |
| 1899 | | 1910 | |
| 1900 | memblock_reserve(req_node->base, req_node->size); | 1911 | memblock_reserve(req_node->base, req_node->size); |
| 1901 | allocated_ptr = run_memblock_alloc_try_nid(size, SMP_CACHE_BYTES, | 1912 | allocated_ptr = run_memblock_alloc_nid(size, SMP_CACHE_BYTES, |
| 1902 | min_addr, max_addr, nid_req); | 1913 | min_addr, max_addr, nid_req); |
| 1903 | | 1914 | |
| 1904 | ASSERT_NE(allocated_ptr, NULL); | 1915 | ASSERT_NE(allocated_ptr, NULL); |
| 1905 | assert_mem_content(allocated_ptr, size, alloc_nid_test_flags); | 1916 | assert_mem_content(allocated_ptr, size, alloc_nid_test_flags); |
| @@ -1931,7 +1942,7 @@ static int alloc_try_nid_bottom_up_numa_node_reserved_check(void) · 25 unmodified lines |
| 1931 | * Expect to allocate an aligned region in the requested node that merges with | 1942 | * Expect to allocate an aligned region in the requested node that merges with |
| 1932 | * the existing reserved region. The total size gets updated. | 1943 | * the existing reserved region. The total size gets updated. |
| 1933 | */ | 1944 | */ |
| 1934 | static int alloc_try_nid_bottom_up_numa_part_reserved_check(void) | 1945 | static int alloc_nid_bottom_up_numa_part_reserved_check(void) |
| 1935 | { | 1946 | { |
| 1936 | int nid_req = 4; | 1947 | int nid_req = 4; |
| 1937 | struct memblock_region *new_rgn = &memblock.reserved.regions[0]; | 1948 | struct memblock_region *new_rgn = &memblock.reserved.regions[0]; |
| @@ -1955,8 +1966,8 @@ static int alloc_try_nid_bottom_up_numa_part_reserved_check(void) · 17 unmodified lines |
| 1955 | total_size = size + r1.size; | 1966 | total_size = size + r1.size; |
| 1956 | | 1967 | |
| 1957 | memblock_reserve(r1.base, r1.size); | 1968 | memblock_reserve(r1.base, r1.size); |
| 1958 | allocated_ptr = run_memblock_alloc_try_nid(size, SMP_CACHE_BYTES, | 1969 | allocated_ptr = run_memblock_alloc_nid(size, SMP_CACHE_BYTES, |
| 1959 | min_addr, max_addr, nid_req); | 1970 | min_addr, max_addr, nid_req); |
| 1960 | | 1971 | |
| 1961 | ASSERT_NE(allocated_ptr, NULL); | 1972 | ASSERT_NE(allocated_ptr, NULL); |
| 1962 | assert_mem_content(allocated_ptr, size, alloc_nid_test_flags); | 1973 | assert_mem_content(allocated_ptr, size, alloc_nid_test_flags); |
| @@ -1991,7 +2002,7 @@ static int alloc_try_nid_bottom_up_numa_part_reserved_check(void) · 28 unmodified lines |
| 1991 | * nid = 0) after falling back to NUMA_NO_NODE. The region count and total size | 2002 | * nid = 0) after falling back to NUMA_NO_NODE. The region count and total size |
| 1992 | * get updated. | 2003 | * get updated. |
| 1993 | */ | 2004 | */ |
| 1994 | static int alloc_try_nid_bottom_up_numa_part_reserved_fallback_check(void) | 2005 | static int alloc_nid_bottom_up_numa_part_reserved_fallback_check(void) |
| 1995 | { | 2006 | { |
| 1996 | int nid_req = 4; | 2007 | int nid_req = 4; |
| 1997 | int nid_exp = 0; | 2008 | int nid_exp = 0; |
| @@ -2016,8 +2027,8 @@ static int alloc_try_nid_bottom_up_numa_part_reserved_fallback_check(void) · 18 unmodified lines |
| 2016 | max_addr = memblock_end_of_DRAM(); | 2027 | max_addr = memblock_end_of_DRAM(); |
| 2017 | | 2028 | |
| 2018 | memblock_reserve(r1.base, r1.size); | 2029 | memblock_reserve(r1.base, r1.size); |
| 2019 | allocated_ptr = run_memblock_alloc_try_nid(size, SMP_CACHE_BYTES, | 2030 | allocated_ptr = run_memblock_alloc_nid(size, SMP_CACHE_BYTES, |
| 2020 | min_addr, max_addr, nid_req); | 2031 | min_addr, max_addr, nid_req); |
| 2021 | | 2032 | |
| 2022 | ASSERT_NE(allocated_ptr, NULL); | 2033 | ASSERT_NE(allocated_ptr, NULL); |
| 2023 | assert_mem_content(allocated_ptr, size, alloc_nid_test_flags); | 2034 | assert_mem_content(allocated_ptr, size, alloc_nid_test_flags); |
| @@ -2054,7 +2065,7 @@ static int alloc_try_nid_bottom_up_numa_part_reserved_fallback_check(void) · 30 unmodified lines |
| 2054 | * Expect to drop the lower limit and allocate a memory region at the beginning | 2065 | * Expect to drop the lower limit and allocate a memory region at the beginning |
| 2055 | * of the requested node. | 2066 | * of the requested node. |
| 2056 | */ | 2067 | */ |
| 2057 | static int alloc_try_nid_bottom_up_numa_split_range_low_check(void) | 2068 | static int alloc_nid_bottom_up_numa_split_range_low_check(void) |
| 2058 | { | 2069 | { |
| 2059 | int nid_req = 2; | 2070 | int nid_req = 2; |
| 2060 | struct memblock_region *new_rgn = &memblock.reserved.regions[0]; | 2071 | struct memblock_region *new_rgn = &memblock.reserved.regions[0]; |
| @@ -2072,8 +2083,8 @@ static int alloc_try_nid_bottom_up_numa_split_range_low_check(void) · 11 unmodified lines |
| 2072 | min_addr = req_node_end - SZ_256; | 2083 | min_addr = req_node_end - SZ_256; |
| 2073 | max_addr = min_addr + size; | 2084 | max_addr = min_addr + size; |
| 2074 | | 2085 | |
| 2075 | allocated_ptr = run_memblock_alloc_try_nid(size, SMP_CACHE_BYTES, | 2086 | allocated_ptr = run_memblock_alloc_nid(size, SMP_CACHE_BYTES, |
| 2076 | min_addr, max_addr, nid_req); | 2087 | min_addr, max_addr, nid_req); |
| 2077 | | 2088 | |
| 2078 | ASSERT_NE(allocated_ptr, NULL); | 2089 | ASSERT_NE(allocated_ptr, NULL); |
| 2079 | assert_mem_content(allocated_ptr, size, alloc_nid_test_flags); | 2090 | assert_mem_content(allocated_ptr, size, alloc_nid_test_flags); |
| @@ -2110,7 +2121,7 @@ static int alloc_try_nid_bottom_up_numa_split_range_low_check(void) · 30 unmodified lines |
| 2110 | * Expect to drop the lower limit and allocate a memory region at the beginning | 2121 | * Expect to drop the lower limit and allocate a memory region at the beginning |
| 2111 | * of the first node that has enough memory. | 2122 | * of the first node that has enough memory. |
| 2112 | */ | 2123 | */ |
| 2113 | static int alloc_try_nid_bottom_up_numa_split_range_high_check(void) | 2124 | static int alloc_nid_bottom_up_numa_split_range_high_check(void) |
| 2114 | { | 2125 | { |
| 2115 | int nid_req = 3; | 2126 | int nid_req = 3; |
| 2116 | int nid_exp = 0; | 2127 | int nid_exp = 0; |
| @@ -2130,8 +2141,8 @@ static int alloc_try_nid_bottom_up_numa_split_range_high_check(void) · 13 unmodified lines |
| 2130 | min_addr = req_node->base - SZ_256; | 2141 | min_addr = req_node->base - SZ_256; |
| 2131 | max_addr = min_addr + size; | 2142 | max_addr = min_addr + size; |
| 2132 | | 2143 | |
| 2133 | allocated_ptr = run_memblock_alloc_try_nid(size, SMP_CACHE_BYTES, | 2144 | allocated_ptr = run_memblock_alloc_nid(size, SMP_CACHE_BYTES, |
| 2134 | min_addr, max_addr, nid_req); | 2145 | min_addr, max_addr, nid_req); |
| 2135 | | 2146 | |
| 2136 | ASSERT_NE(allocated_ptr, NULL); | 2147 | ASSERT_NE(allocated_ptr, NULL); |
| 2137 | assert_mem_content(allocated_ptr, size, alloc_nid_test_flags); | 2148 | assert_mem_content(allocated_ptr, size, alloc_nid_test_flags); |
| @@ -2168,7 +2179,7 @@ static int alloc_try_nid_bottom_up_numa_split_range_high_check(void) · 30 unmodified lines |
| 2168 | * Expect to drop the lower limit and allocate a memory region that starts at | 2179 | * Expect to drop the lower limit and allocate a memory region that starts at |
| 2169 | * the beginning of the requested node. | 2180 | * the beginning of the requested node. |
| 2170 | */ | 2181 | */ |
| 2171 | static int alloc_try_nid_bottom_up_numa_no_overlap_split_check(void) | 2182 | static int alloc_nid_bottom_up_numa_no_overlap_split_check(void) |
| 2172 | { | 2183 | { |
| 2173 | int nid_req = 2; | 2184 | int nid_req = 2; |
| 2174 | struct memblock_region *new_rgn = &memblock.reserved.regions[0]; | 2185 | struct memblock_region *new_rgn = &memblock.reserved.regions[0]; |
| @@ -2186,8 +2197,8 @@ static int alloc_try_nid_bottom_up_numa_no_overlap_split_check(void) · 11 unmodified lines |
| 2186 | min_addr = node2->base - SZ_256; | 2197 | min_addr = node2->base - SZ_256; |
| 2187 | max_addr = min_addr + size; | 2198 | max_addr = min_addr + size; |
| 2188 | | 2199 | |
| 2189 | allocated_ptr = run_memblock_alloc_try_nid(size, SMP_CACHE_BYTES, | 2200 | allocated_ptr = run_memblock_alloc_nid(size, SMP_CACHE_BYTES, |
| 2190 | min_addr, max_addr, nid_req); | 2201 | min_addr, max_addr, nid_req); |
| 2191 | | 2202 | |
| 2192 | ASSERT_NE(allocated_ptr, NULL); | 2203 | ASSERT_NE(allocated_ptr, NULL); |
| 2193 | assert_mem_content(allocated_ptr, size, alloc_nid_test_flags); | 2204 | assert_mem_content(allocated_ptr, size, alloc_nid_test_flags); |
| @@ -2225,7 +2236,7 @@ static int alloc_try_nid_bottom_up_numa_no_overlap_split_check(void) · 31 unmodified lines |
| 2225 | * Expect to allocate a memory region at the beginning of the first node | 2236 | * Expect to allocate a memory region at the beginning of the first node |
| 2226 | * in the range after falling back to NUMA_NO_NODE. | 2237 | * in the range after falling back to NUMA_NO_NODE. |
| 2227 | */ | 2238 | */ |
| 2228 | static int alloc_try_nid_bottom_up_numa_no_overlap_low_check(void) | 2239 | static int alloc_nid_bottom_up_numa_no_overlap_low_check(void) |
| 2229 | { | 2240 | { |
| 2230 | int nid_req = 0; | 2241 | int nid_req = 0; |
| 2231 | struct memblock_region *new_rgn = &memblock.reserved.regions[0]; | 2242 | struct memblock_region *new_rgn = &memblock.reserved.regions[0]; |
| @@ -2242,8 +2253,8 @@ static int alloc_try_nid_bottom_up_numa_no_overlap_low_check(void) · 10 unmodified lines |
| 2242 | min_addr = min_node->base; | 2253 | min_addr = min_node->base; |
| 2243 | max_addr = region_end(max_node); | 2254 | max_addr = region_end(max_node); |
| 2244 | | 2255 | |
| 2245 | allocated_ptr = run_memblock_alloc_try_nid(size, SMP_CACHE_BYTES, | 2256 | allocated_ptr = run_memblock_alloc_nid(size, SMP_CACHE_BYTES, |
| 2246 | min_addr, max_addr, nid_req); | 2257 | min_addr, max_addr, nid_req); |
| 2247 | | 2258 | |
| 2248 | ASSERT_NE(allocated_ptr, NULL); | 2259 | ASSERT_NE(allocated_ptr, NULL); |
| 2249 | assert_mem_content(allocated_ptr, size, alloc_nid_test_flags); | 2260 | assert_mem_content(allocated_ptr, size, alloc_nid_test_flags); |
| @@ -2281,7 +2292,7 @@ static int alloc_try_nid_bottom_up_numa_no_overlap_low_check(void) · 31 unmodified lines |
| 2281 | * Expect to allocate a memory region at the beginning of the first node | 2292 | * Expect to allocate a memory region at the beginning of the first node |
| 2282 | * in the range after falling back to NUMA_NO_NODE. | 2293 | * in the range after falling back to NUMA_NO_NODE. |
| 2283 | */ | 2294 | */ |
| 2284 | static int alloc_try_nid_bottom_up_numa_no_overlap_high_check(void) | 2295 | static int alloc_nid_bottom_up_numa_no_overlap_high_check(void) |
| 2285 | { | 2296 | { |
| 2286 | int nid_req = 7; | 2297 | int nid_req = 7; |
| 2287 | struct memblock_region *new_rgn = &memblock.reserved.regions[0]; | 2298 | struct memblock_region *new_rgn = &memblock.reserved.regions[0]; |
| @@ -2298,8 +2309,8 @@ static int alloc_try_nid_bottom_up_numa_no_overlap_high_check(void) · 10 unmodified lines |
| 2298 | min_addr = min_node->base; | 2309 | min_addr = min_node->base; |
| 2299 | max_addr = region_end(max_node); | 2310 | max_addr = region_end(max_node); |
| 2300 | | 2311 | |
| 2301 | allocated_ptr = run_memblock_alloc_try_nid(size, SMP_CACHE_BYTES, | 2312 | allocated_ptr = run_memblock_alloc_nid(size, SMP_CACHE_BYTES, |
| 2302 | min_addr, max_addr, nid_req); | 2313 | min_addr, max_addr, nid_req); |
| 2303 | | 2314 | |
| 2304 | ASSERT_NE(allocated_ptr, NULL); | 2315 | ASSERT_NE(allocated_ptr, NULL); |
| 2305 | assert_mem_content(allocated_ptr, size, alloc_nid_test_flags); | 2316 | assert_mem_content(allocated_ptr, size, alloc_nid_test_flags); |
| @@ -2330,7 +2341,7 @@ static int alloc_try_nid_bottom_up_numa_no_overlap_high_check(void) · 24 unmodified lines |
| 2330 | * | 2341 | * |
| 2331 | * Expect no allocation to happen. | 2342 | * Expect no allocation to happen. |
| 2332 | */ | 2343 | */ |
| 2333 | static int alloc_try_nid_numa_large_region_generic_check(void) | 2344 | static int alloc_nid_numa_large_region_generic_check(void) |
| 2334 | { | 2345 | { |
| 2335 | int nid_req = 3; | 2346 | int nid_req = 3; |
| 2336 | void *allocated_ptr = NULL; | 2347 | void *allocated_ptr = NULL; |
| @@ -2344,8 +2355,8 @@ static int alloc_try_nid_numa_large_region_generic_check(void) · 7 unmodified lines |
| 2344 | min_addr = memblock_start_of_DRAM(); | 2355 | min_addr = memblock_start_of_DRAM(); |
| 2345 | max_addr = memblock_end_of_DRAM(); | 2356 | max_addr = memblock_end_of_DRAM(); |
| 2346 | | 2357 | |
| 2347 | allocated_ptr = run_memblock_alloc_try_nid(size, SMP_CACHE_BYTES, | 2358 | allocated_ptr = run_memblock_alloc_nid(size, SMP_CACHE_BYTES, |
| 2348 | min_addr, max_addr, nid_req); | 2359 | min_addr, max_addr, nid_req); |
| 2349 | ASSERT_EQ(allocated_ptr, NULL); | 2360 | ASSERT_EQ(allocated_ptr, NULL); |
| 2350 | | 2361 | |
| 2351 | test_pass_pop(); | 2362 | test_pass_pop(); |
| @@ -2374,7 +2385,7 @@ static int alloc_try_nid_numa_large_region_generic_check(void) · 22 unmodified lines |
| 2374 | * Expect to merge all of the regions into one. The region counter and total | 2385 | * Expect to merge all of the regions into one. The region counter and total |
| 2375 | * size fields get updated. | 2386 | * size fields get updated. |
| 2376 | */ | 2387 | */ |
| 2377 | static int alloc_try_nid_numa_reserved_full_merge_generic_check(void) | 2388 | static int alloc_nid_numa_reserved_full_merge_generic_check(void) |
| 2378 | { | 2389 | { |
| 2379 | int nid_req = 6; | 2390 | int nid_req = 6; |
| 2380 | int nid_next = nid_req + 1; | 2391 | int nid_next = nid_req + 1; |
| @@ -2404,8 +2415,8 @@ static int alloc_try_nid_numa_reserved_full_merge_generic_check(void) · 23 unmodified lines |
| 2404 | memblock_reserve(r1.base, r1.size); | 2415 | memblock_reserve(r1.base, r1.size); |
| 2405 | memblock_reserve(r2.base, r2.size); | 2416 | memblock_reserve(r2.base, r2.size); |
| 2406 | | 2417 | |
| 2407 | allocated_ptr = run_memblock_alloc_try_nid(size, SMP_CACHE_BYTES, | 2418 | allocated_ptr = run_memblock_alloc_nid(size, SMP_CACHE_BYTES, |
| 2408 | min_addr, max_addr, nid_req); | 2419 | min_addr, max_addr, nid_req); |
| 2409 | | 2420 | |
| 2410 | ASSERT_NE(allocated_ptr, NULL); | 2421 | ASSERT_NE(allocated_ptr, NULL); |
| 2411 | assert_mem_content(allocated_ptr, size, alloc_nid_test_flags); | 2422 | assert_mem_content(allocated_ptr, size, alloc_nid_test_flags); |
| @@ -2448,7 +2459,7 @@ static int alloc_try_nid_numa_reserved_full_merge_generic_check(void) · 36 unmodified lines |
| 2448 | * | 2459 | * |
| 2449 | * Expect no allocation to happen. | 2460 | * Expect no allocation to happen. |
| 2450 | */ | 2461 | */ |
| 2451 | static int alloc_try_nid_numa_split_all_reserved_generic_check(void) | 2462 | static int alloc_nid_numa_split_all_reserved_generic_check(void) |
| 2452 | { | 2463 | { |
| 2453 | void *allocated_ptr = NULL; | 2464 | void *allocated_ptr = NULL; |
| 2454 | struct memblock_region *next_node = &memblock.memory.regions[7]; | 2465 | struct memblock_region *next_node = &memblock.memory.regions[7]; |
| @@ -2472,9 +2483,9 @@ static int alloc_try_nid_numa_split_all_reserved_generic_check(void) · 17 unmodified lines |
| 2472 | memblock_reserve(r1.base, r1.size); | 2483 | memblock_reserve(r1.base, r1.size); |
| 2473 | memblock_reserve(r2.base, r2.size); | 2484 | memblock_reserve(r2.base, r2.size); |
| 2474 | | 2485 | |
| 2475 | allocated_ptr = run_memblock_alloc_try_nid(size, SMP_CACHE_BYTES, | 2486 | allocated_ptr = run_memblock_alloc_nid(size, SMP_CACHE_BYTES, |
| 2476 | min_addr, max_addr, | 2487 | min_addr, max_addr, |
| 2477 | NUMA_NO_NODE); | 2488 | NUMA_NO_NODE); |
| 2478 | | 2489 | |
| 2479 | ASSERT_EQ(allocated_ptr, NULL); | 2490 | ASSERT_EQ(allocated_ptr, NULL); |
| 2480 | | 2491 | |
| @@ -2484,139 +2495,139 @@ static int alloc_try_nid_numa_split_all_reserved_generic_check(void) · 3 unmodified lines |
| 2484 | } | 2495 | } |
| 2485 | | 2496 | |
| 2486 | /* Test case wrappers for NUMA tests */ | 2497 | /* Test case wrappers for NUMA tests */ |
| 2487 | static int alloc_try_nid_numa_simple_check(void) | 2498 | static int alloc_nid_numa_simple_check(void) |
| 2488 | { | 2499 | { |
| 2489 | test_print("\tRunning %s...\n", __func__); | 2500 | test_print("\tRunning %s...\n", __func__); |
| 2490 | memblock_set_bottom_up(false); | 2501 | memblock_set_bottom_up(false); |
| 2491 | alloc_try_nid_top_down_numa_simple_check(); | 2502 | alloc_nid_top_down_numa_simple_check(); |
| 2492 | memblock_set_bottom_up(true); | 2503 | memblock_set_bottom_up(true); |
| 2493 | alloc_try_nid_bottom_up_numa_simple_check(); | 2504 | alloc_nid_bottom_up_numa_simple_check(); |
| 2494 | | 2505 | |
| 2495 | return 0; | 2506 | return 0; |
| 2496 | } | 2507 | } |
| 2497 | | 2508 | |
| 2498 | static int alloc_try_nid_numa_small_node_check(void) | 2509 | static int alloc_nid_numa_small_node_check(void) |
| 2499 | { | 2510 | { |
| 2500 | test_print("\tRunning %s...\n", __func__); | 2511 | test_print("\tRunning %s...\n", __func__); |
| 2501 | memblock_set_bottom_up(false); | 2512 | memblock_set_bottom_up(false); |
| 2502 | alloc_try_nid_top_down_numa_small_node_check(); | 2513 | alloc_nid_top_down_numa_small_node_check(); |
| 2503 | memblock_set_bottom_up(true); | 2514 | memblock_set_bottom_up(true); |
| 2504 | alloc_try_nid_bottom_up_numa_small_node_check(); | 2515 | alloc_nid_bottom_up_numa_small_node_check(); |
| 2505 | | 2516 | |
| 2506 | return 0; | 2517 | return 0; |
| 2507 | } | 2518 | } |
| 2508 | | 2519 | |
| 2509 | static int alloc_try_nid_numa_node_reserved_check(void) | 2520 | static int alloc_nid_numa_node_reserved_check(void) |
| 2510 | { | 2521 | { |
| 2511 | test_print("\tRunning %s...\n", __func__); | 2522 | test_print("\tRunning %s...\n", __func__); |
| 2512 | memblock_set_bottom_up(false); | 2523 | memblock_set_bottom_up(false); |
| 2513 | alloc_try_nid_top_down_numa_node_reserved_check(); | 2524 | alloc_nid_top_down_numa_node_reserved_check(); |
| 2514 | memblock_set_bottom_up(true); | 2525 | memblock_set_bottom_up(true); |
| 2515 | alloc_try_nid_bottom_up_numa_node_reserved_check(); | 2526 | alloc_nid_bottom_up_numa_node_reserved_check(); |
| 2516 | | 2527 | |
| 2517 | return 0; | 2528 | return 0; |
| 2518 | } | 2529 | } |
| 2519 | | 2530 | |
| 2520 | static int alloc_try_nid_numa_part_reserved_check(void) | 2531 | static int alloc_nid_numa_part_reserved_check(void) |
| 2521 | { | 2532 | { |
| 2522 | test_print("\tRunning %s...\n", __func__); | 2533 | test_print("\tRunning %s...\n", __func__); |
| 2523 | memblock_set_bottom_up(false); | 2534 | memblock_set_bottom_up(false); |
| 2524 | alloc_try_nid_top_down_numa_part_reserved_check(); | 2535 | alloc_nid_top_down_numa_part_reserved_check(); |
| 2525 | memblock_set_bottom_up(true); | 2536 | memblock_set_bottom_up(true); |
| 2526 | alloc_try_nid_bottom_up_numa_part_reserved_check(); | 2537 | alloc_nid_bottom_up_numa_part_reserved_check(); |
| 2527 | | 2538 | |
| 2528 | return 0; | 2539 | return 0; |
| 2529 | } | 2540 | } |
| 2530 | | 2541 | |
| 2531 | static int alloc_try_nid_numa_part_reserved_fallback_check(void) | 2542 | static int alloc_nid_numa_part_reserved_fallback_check(void) |
| 2532 | { | 2543 | { |
| 2533 | test_print("\tRunning %s...\n", __func__); | 2544 | test_print("\tRunning %s...\n", __func__); |
| 2534 | memblock_set_bottom_up(false); | 2545 | memblock_set_bottom_up(false); |
| 2535 | alloc_try_nid_top_down_numa_part_reserved_fallback_check(); | 2546 | alloc_nid_top_down_numa_part_reserved_fallback_check(); |
| 2536 | memblock_set_bottom_up(true); | 2547 | memblock_set_bottom_up(true); |
| 2537 | alloc_try_nid_bottom_up_numa_part_reserved_fallback_check(); | 2548 | alloc_nid_bottom_up_numa_part_reserved_fallback_check(); |
| 2538 | | 2549 | |
| 2539 | return 0; | 2550 | return 0; |
| 2540 | } | 2551 | } |
| 2541 | | 2552 | |
| 2542 | static int alloc_try_nid_numa_split_range_low_check(void) | 2553 | static int alloc_nid_numa_split_range_low_check(void) |
| 2543 | { | 2554 | { |
| 2544 | test_print("\tRunning %s...\n", __func__); | 2555 | test_print("\tRunning %s...\n", __func__); |
| 2545 | memblock_set_bottom_up(false); | 2556 | memblock_set_bottom_up(false); |
| 2546 | alloc_try_nid_top_down_numa_split_range_low_check(); | 2557 | alloc_nid_top_down_numa_split_range_low_check(); |
| 2547 | memblock_set_bottom_up(true); | 2558 | memblock_set_bottom_up(true); |
| 2548 | alloc_try_nid_bottom_up_numa_split_range_low_check(); | 2559 | alloc_nid_bottom_up_numa_split_range_low_check(); |
| 2549 | | 2560 | |
| 2550 | return 0; | 2561 | return 0; |
| 2551 | } | 2562 | } |
| 2552 | | 2563 | |
| 2553 | static int alloc_try_nid_numa_split_range_high_check(void) | 2564 | static int alloc_nid_numa_split_range_high_check(void) |
| 2554 | { | 2565 | { |
| 2555 | test_print("\tRunning %s...\n", __func__); | 2566 | test_print("\tRunning %s...\n", __func__); |
| 2556 | memblock_set_bottom_up(false); | 2567 | memblock_set_bottom_up(false); |
| 2557 | alloc_try_nid_top_down_numa_split_range_high_check(); | 2568 | alloc_nid_top_down_numa_split_range_high_check(); |
| 2558 | memblock_set_bottom_up(true); | 2569 | memblock_set_bottom_up(true); |
| 2559 | alloc_try_nid_bottom_up_numa_split_range_high_check(); | 2570 | alloc_nid_bottom_up_numa_split_range_high_check(); |
| 2560 | | 2571 | |
| 2561 | return 0; | 2572 | return 0; |
| 2562 | } | 2573 | } |
| 2563 | | 2574 | |
| 2564 | static int alloc_try_nid_numa_no_overlap_split_check(void) | 2575 | static int alloc_nid_numa_no_overlap_split_check(void) |
| 2565 | { | 2576 | { |
| 2566 | test_print("\tRunning %s...\n", __func__); | 2577 | test_print("\tRunning %s...\n", __func__); |
| 2567 | memblock_set_bottom_up(false); | 2578 | memblock_set_bottom_up(false); |
| 2568 | alloc_try_nid_top_down_numa_no_overlap_split_check(); | 2579 | alloc_nid_top_down_numa_no_overlap_split_check(); |
| 2569 | memblock_set_bottom_up(true); | 2580 | memblock_set_bottom_up(true); |
| 2570 | alloc_try_nid_bottom_up_numa_no_overlap_split_check(); | 2581 | alloc_nid_bottom_up_numa_no_overlap_split_check(); |
| 2571 | | 2582 | |
| 2572 | return 0; | 2583 | return 0; |
| 2573 | } | 2584 | } |
| 2574 | | 2585 | |
| 2575 | static int alloc_try_nid_numa_no_overlap_low_check(void) | 2586 | static int alloc_nid_numa_no_overlap_low_check(void) |
| 2576 | { | 2587 | { |
| 2577 | test_print("\tRunning %s...\n", __func__); | 2588 | test_print("\tRunning %s...\n", __func__); |
| 2578 | memblock_set_bottom_up(false); | 2589 | memblock_set_bottom_up(false); |
| 2579 | alloc_try_nid_top_down_numa_no_overlap_low_check(); | 2590 | alloc_nid_top_down_numa_no_overlap_low_check(); |
| 2580 | memblock_set_bottom_up(true); | 2591 | memblock_set_bottom_up(true); |
| 2581 | alloc_try_nid_bottom_up_numa_no_overlap_low_check(); | 2592 | alloc_nid_bottom_up_numa_no_overlap_low_check(); |
| 2582 | | 2593 | |
| 2583 | return 0; | 2594 | return 0; |
| 2584 | } | 2595 | } |
| 2585 | | 2596 | |
| 2586 | static int alloc_try_nid_numa_no_overlap_high_check(void) | 2597 | static int alloc_nid_numa_no_overlap_high_check(void) |
| 2587 | { | 2598 | { |
| 2588 | test_print("\tRunning %s...\n", __func__); | 2599 | test_print("\tRunning %s...\n", __func__); |
| 2589 | memblock_set_bottom_up(false); | 2600 | memblock_set_bottom_up(false); |
| 2590 | alloc_try_nid_top_down_numa_no_overlap_high_check(); | 2601 | alloc_nid_top_down_numa_no_overlap_high_check(); |
| 2591 | memblock_set_bottom_up(true); | 2602 | memblock_set_bottom_up(true); |
| 2592 | alloc_try_nid_bottom_up_numa_no_overlap_high_check(); | 2603 | alloc_nid_bottom_up_numa_no_overlap_high_check(); |
| 2593 | | 2604 | |
| 2594 | return 0; | 2605 | return 0; |
| 2595 | } | 2606 | } |
| 2596 | | 2607 | |
| 2597 | static int alloc_try_nid_numa_large_region_check(void) | 2608 | static int alloc_nid_numa_large_region_check(void) |
| 2598 | { | 2609 | { |
| 2599 | test_print("\tRunning %s...\n", __func__); | 2610 | test_print("\tRunning %s...\n", __func__); |
| 2600 | run_top_down(alloc_try_nid_numa_large_region_generic_check); | 2611 | run_top_down(alloc_nid_numa_large_region_generic_check); |
| 2601 | run_bottom_up(alloc_try_nid_numa_large_region_generic_check); | 2612 | run_bottom_up(alloc_nid_numa_large_region_generic_check); |
| 2602 | | 2613 | |
| 2603 | return 0; | 2614 | return 0; |
| 2604 | } | 2615 | } |
| 2605 | | 2616 | |
| 2606 | static int alloc_try_nid_numa_reserved_full_merge_check(void) | 2617 | static int alloc_nid_numa_reserved_full_merge_check(void) |
| 2607 | { | 2618 | { |
| 2608 | test_print("\tRunning %s...\n", __func__); | 2619 | test_print("\tRunning %s...\n", __func__); |
| 2609 | run_top_down(alloc_try_nid_numa_reserved_full_merge_generic_check); | 2620 | run_top_down(alloc_nid_numa_reserved_full_merge_generic_check); |
| 2610 | run_bottom_up(alloc_try_nid_numa_reserved_full_merge_generic_check); | 2621 | run_bottom_up(alloc_nid_numa_reserved_full_merge_generic_check); |
| 2611 | | 2622 | |
| 2612 | return 0; | 2623 | return 0; |
| 2613 | } | 2624 | } |
| 2614 | | 2625 | |
| 2615 | static int alloc_try_nid_numa_split_all_reserved_check(void) | 2626 | static int alloc_nid_numa_split_all_reserved_check(void) |
| 2616 | { | 2627 | { |
| 2617 | test_print("\tRunning %s...\n", __func__); | 2628 | test_print("\tRunning %s...\n", __func__); |
| 2618 | run_top_down(alloc_try_nid_numa_split_all_reserved_generic_check); | 2629 | run_top_down(alloc_nid_numa_split_all_reserved_generic_check); |
| 2619 | run_bottom_up(alloc_try_nid_numa_split_all_reserved_generic_check); | 2630 | run_bottom_up(alloc_nid_numa_split_all_reserved_generic_check); |
| 2620 | | 2631 | |
| 2621 | return 0; | 2632 | return 0; |
| 2622 | } | 2633 | } |
| @@ -2624,22 +2635,22 @@ static int alloc_try_nid_numa_split_all_reserved_check(void) · 1 unmodified line |
| 2624 | int __memblock_alloc_nid_numa_checks(void) | 2635 | int __memblock_alloc_nid_numa_checks(void) |
| 2625 | { | 2636 | { |
| 2626 | test_print("Running %s NUMA tests...\n", | 2637 | test_print("Running %s NUMA tests...\n", |
| 2627 | get_memblock_alloc_try_nid_name(alloc_nid_test_flags)); | 2638 | get_memblock_alloc_nid_name(alloc_nid_test_flags)); |
| 2628 | | 2639 | |
| 2629 | alloc_try_nid_numa_simple_check(); | 2640 | alloc_nid_numa_simple_check(); |
| 2630 | alloc_try_nid_numa_small_node_check(); | 2641 | alloc_nid_numa_small_node_check(); |
| 2631 | alloc_try_nid_numa_node_reserved_check(); | 2642 | alloc_nid_numa_node_reserved_check(); |
| 2632 | alloc_try_nid_numa_part_reserved_check(); | 2643 | alloc_nid_numa_part_reserved_check(); |
| 2633 | alloc_try_nid_numa_part_reserved_fallback_check(); | 2644 | alloc_nid_numa_part_reserved_fallback_check(); |
| 2634 | alloc_try_nid_numa_split_range_low_check(); | 2645 | alloc_nid_numa_split_range_low_check(); |
| 2635 | alloc_try_nid_numa_split_range_high_check(); | 2646 | alloc_nid_numa_split_range_high_check(); |
| 2636 | | 2647 | |
| 2637 | alloc_try_nid_numa_no_overlap_split_check(); | 2648 | alloc_nid_numa_no_overlap_split_check(); |
| 2638 | alloc_try_nid_numa_no_overlap_low_check(); | 2649 | alloc_nid_numa_no_overlap_low_check(); |
| 2639 | alloc_try_nid_numa_no_overlap_high_check(); | 2650 | alloc_nid_numa_no_overlap_high_check(); |
| 2640 | alloc_try_nid_numa_large_region_check(); | 2651 | alloc_nid_numa_large_region_check(); |
| 2641 | alloc_try_nid_numa_reserved_full_merge_check(); | 2652 | alloc_nid_numa_reserved_full_merge_check(); |
| 2642 | alloc_try_nid_numa_split_all_reserved_check(); | 2653 | alloc_nid_numa_split_all_reserved_check(); |
| 2643 | | 2654 | |
| 2644 | return 0; | 2655 | return 0; |
| 2645 | } | 2656 | } |
| @@ -2649,7 +2660,7 @@ static int memblock_alloc_nid_checks_internal(int flags) · 3 unmodified lines |
| 2649 | alloc_nid_test_flags = flags; | 2660 | alloc_nid_test_flags = flags; |
| 2650 | | 2661 | |
| 2651 | prefix_reset(); | 2662 | prefix_reset(); |
| 2652 | prefix_push(get_memblock_alloc_try_nid_name(flags)); | 2663 | prefix_push(get_memblock_alloc_nid_name(flags)); |
| 2653 | | 2664 | |
| 2654 | reset_memblock_attributes(); | 2665 | reset_memblock_attributes(); |
| 2655 | dummy_physical_memory_init(); | 2666 | dummy_physical_memory_init(); |
| @@ -2671,3 +2682,12 @@ int memblock_alloc_nid_checks(void) · 15 unmodified lines |
| 2671 | | 2682 | |
| 2672 | return 0; | 2683 | return 0; |
| 2673 | } | 2684 | } |
| | 2685 | |
| | 2686 | int memblock_alloc_exact_nid_range_checks(void) |
| | 2687 | { |
| | 2688 | alloc_nid_test_flags = (TEST_F_RAW | TEST_F_EXACT); |
| | 2689 | |
| | 2690 | memblock_alloc_nid_range_checks(); |
| | 2691 | |
| | 2692 | return 0; |
| | 2693 | } |