Commit 61da0332 authored by Rebecca Mckeever's avatar Rebecca Mckeever Committed by Mike Rapoport

memblock tests: introduce range tests for memblock_alloc_exact_nid_raw

Add TEST_F_EXACT flag, which specifies that tests should run
memblock_alloc_exact_nid_raw(). Introduce range tests for
memblock_alloc_exact_nid_raw() by using the TEST_F_EXACT flag to run the
range tests in alloc_nid_api.c, since memblock_alloc_exact_nid_raw() and
memblock_alloc_try_nid_raw() behave the same way when nid = NUMA_NO_NODE.

Rename tests and other functions in alloc_nid_api.c by removing "_try".
Since the test names will be displayed in verbose output, they need to
be general enough to refer to any of the memblock functions that the
tests may run.
Acked-by: default avatarDavid Hildenbrand <david@redhat.com>
Signed-off-by: default avatarRebecca Mckeever <remckee0@gmail.com>
Signed-off-by: default avatarMike Rapoport <rppt@linux.ibm.com>
Link: https://lore.kernel.org/r/5a4b6d1b6130ab7375314e1c45a6d5813dfdabbd.1667802195.git.remckee0@gmail.com
parent 62a56c54
...@@ -7,7 +7,7 @@ CFLAGS += -I. -I../../include -Wall -O2 -fsanitize=address \ ...@@ -7,7 +7,7 @@ CFLAGS += -I. -I../../include -Wall -O2 -fsanitize=address \
LDFLAGS += -fsanitize=address -fsanitize=undefined LDFLAGS += -fsanitize=address -fsanitize=undefined
TARGETS = main TARGETS = main
TEST_OFILES = tests/alloc_nid_api.o tests/alloc_helpers_api.o tests/alloc_api.o \ TEST_OFILES = tests/alloc_nid_api.o tests/alloc_helpers_api.o tests/alloc_api.o \
tests/basic_api.o tests/common.o tests/basic_api.o tests/common.o tests/alloc_exact_nid_api.o
DEP_OFILES = memblock.o lib/slab.o mmzone.o slab.o DEP_OFILES = memblock.o lib/slab.o mmzone.o slab.o
OFILES = main.o $(DEP_OFILES) $(TEST_OFILES) OFILES = main.o $(DEP_OFILES) $(TEST_OFILES)
EXTR_SRC = ../../../mm/memblock.c EXTR_SRC = ../../../mm/memblock.c
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
#include "tests/alloc_api.h" #include "tests/alloc_api.h"
#include "tests/alloc_helpers_api.h" #include "tests/alloc_helpers_api.h"
#include "tests/alloc_nid_api.h" #include "tests/alloc_nid_api.h"
#include "tests/alloc_exact_nid_api.h"
#include "tests/common.h" #include "tests/common.h"
int main(int argc, char **argv) int main(int argc, char **argv)
...@@ -12,6 +13,7 @@ int main(int argc, char **argv) ...@@ -12,6 +13,7 @@ int main(int argc, char **argv)
memblock_alloc_checks(); memblock_alloc_checks();
memblock_alloc_helpers_checks(); memblock_alloc_helpers_checks();
memblock_alloc_nid_checks(); memblock_alloc_nid_checks();
memblock_alloc_exact_nid_checks();
return 0; return 0;
} }
// SPDX-License-Identifier: GPL-2.0-or-later
#include "alloc_exact_nid_api.h"
#include "alloc_nid_api.h"
#define FUNC_NAME "memblock_alloc_exact_nid_raw"
int memblock_alloc_exact_nid_checks(void)
{
prefix_reset();
prefix_push(FUNC_NAME);
reset_memblock_attributes();
dummy_physical_memory_init();
memblock_alloc_exact_nid_range_checks();
dummy_physical_memory_cleanup();
prefix_pop();
return 0;
}
/* SPDX-License-Identifier: GPL-2.0-or-later */
#ifndef _MEMBLOCK_ALLOC_EXACT_NID_H
#define _MEMBLOCK_ALLOC_EXACT_NID_H
#include "common.h"
int memblock_alloc_exact_nid_checks(void);
#endif
...@@ -18,18 +18,29 @@ static const unsigned int node_fractions[] = { ...@@ -18,18 +18,29 @@ static const unsigned int node_fractions[] = {
625, /* 1/16 */ 625, /* 1/16 */
}; };
static inline const char * const get_memblock_alloc_try_nid_name(int flags) static inline const char * const get_memblock_alloc_nid_name(int flags)
{ {
if (flags & TEST_F_EXACT)
return "memblock_alloc_exact_nid_raw";
if (flags & TEST_F_RAW) if (flags & TEST_F_RAW)
return "memblock_alloc_try_nid_raw"; return "memblock_alloc_try_nid_raw";
return "memblock_alloc_try_nid"; return "memblock_alloc_try_nid";
} }
static inline void *run_memblock_alloc_try_nid(phys_addr_t size, static inline void *run_memblock_alloc_nid(phys_addr_t size,
phys_addr_t align, phys_addr_t align,
phys_addr_t min_addr, phys_addr_t min_addr,
phys_addr_t max_addr, int nid) phys_addr_t max_addr, int nid)
{ {
assert(!(alloc_nid_test_flags & TEST_F_EXACT) ||
(alloc_nid_test_flags & TEST_F_RAW));
/*
* TEST_F_EXACT should be checked before TEST_F_RAW since
* memblock_alloc_exact_nid_raw() performs raw allocations.
*/
if (alloc_nid_test_flags & TEST_F_EXACT)
return memblock_alloc_exact_nid_raw(size, align, min_addr,
max_addr, nid);
if (alloc_nid_test_flags & TEST_F_RAW) if (alloc_nid_test_flags & TEST_F_RAW)
return memblock_alloc_try_nid_raw(size, align, min_addr, return memblock_alloc_try_nid_raw(size, align, min_addr,
max_addr, nid); max_addr, nid);
...@@ -50,7 +61,7 @@ static inline void *run_memblock_alloc_try_nid(phys_addr_t size, ...@@ -50,7 +61,7 @@ static inline void *run_memblock_alloc_try_nid(phys_addr_t size,
* *
* Expect to allocate a region that ends at max_addr. * Expect to allocate a region that ends at max_addr.
*/ */
static int alloc_try_nid_top_down_simple_check(void) static int alloc_nid_top_down_simple_check(void)
{ {
struct memblock_region *rgn = &memblock.reserved.regions[0]; struct memblock_region *rgn = &memblock.reserved.regions[0];
void *allocated_ptr = NULL; void *allocated_ptr = NULL;
...@@ -65,7 +76,7 @@ static int alloc_try_nid_top_down_simple_check(void) ...@@ -65,7 +76,7 @@ static int alloc_try_nid_top_down_simple_check(void)
min_addr = memblock_start_of_DRAM() + SMP_CACHE_BYTES * 2; min_addr = memblock_start_of_DRAM() + SMP_CACHE_BYTES * 2;
max_addr = min_addr + SZ_512; max_addr = min_addr + SZ_512;
allocated_ptr = run_memblock_alloc_try_nid(size, SMP_CACHE_BYTES, allocated_ptr = run_memblock_alloc_nid(size, SMP_CACHE_BYTES,
min_addr, max_addr, min_addr, max_addr,
NUMA_NO_NODE); NUMA_NO_NODE);
rgn_end = rgn->base + rgn->size; rgn_end = rgn->base + rgn->size;
...@@ -102,7 +113,7 @@ static int alloc_try_nid_top_down_simple_check(void) ...@@ -102,7 +113,7 @@ static int alloc_try_nid_top_down_simple_check(void)
* *
* Expect to allocate an aligned region that ends before max_addr. * Expect to allocate an aligned region that ends before max_addr.
*/ */
static int alloc_try_nid_top_down_end_misaligned_check(void) static int alloc_nid_top_down_end_misaligned_check(void)
{ {
struct memblock_region *rgn = &memblock.reserved.regions[0]; struct memblock_region *rgn = &memblock.reserved.regions[0];
void *allocated_ptr = NULL; void *allocated_ptr = NULL;
...@@ -118,7 +129,7 @@ static int alloc_try_nid_top_down_end_misaligned_check(void) ...@@ -118,7 +129,7 @@ static int alloc_try_nid_top_down_end_misaligned_check(void)
min_addr = memblock_start_of_DRAM() + SMP_CACHE_BYTES * 2; min_addr = memblock_start_of_DRAM() + SMP_CACHE_BYTES * 2;
max_addr = min_addr + SZ_512 + misalign; max_addr = min_addr + SZ_512 + misalign;
allocated_ptr = run_memblock_alloc_try_nid(size, SMP_CACHE_BYTES, allocated_ptr = run_memblock_alloc_nid(size, SMP_CACHE_BYTES,
min_addr, max_addr, min_addr, max_addr,
NUMA_NO_NODE); NUMA_NO_NODE);
rgn_end = rgn->base + rgn->size; rgn_end = rgn->base + rgn->size;
...@@ -153,7 +164,7 @@ static int alloc_try_nid_top_down_end_misaligned_check(void) ...@@ -153,7 +164,7 @@ static int alloc_try_nid_top_down_end_misaligned_check(void)
* Expect to allocate a region that starts at min_addr and ends at * Expect to allocate a region that starts at min_addr and ends at
* max_addr, given that min_addr is aligned. * max_addr, given that min_addr is aligned.
*/ */
static int alloc_try_nid_exact_address_generic_check(void) static int alloc_nid_exact_address_generic_check(void)
{ {
struct memblock_region *rgn = &memblock.reserved.regions[0]; struct memblock_region *rgn = &memblock.reserved.regions[0];
void *allocated_ptr = NULL; void *allocated_ptr = NULL;
...@@ -168,7 +179,7 @@ static int alloc_try_nid_exact_address_generic_check(void) ...@@ -168,7 +179,7 @@ static int alloc_try_nid_exact_address_generic_check(void)
min_addr = memblock_start_of_DRAM() + SMP_CACHE_BYTES; min_addr = memblock_start_of_DRAM() + SMP_CACHE_BYTES;
max_addr = min_addr + size; max_addr = min_addr + size;
allocated_ptr = run_memblock_alloc_try_nid(size, SMP_CACHE_BYTES, allocated_ptr = run_memblock_alloc_nid(size, SMP_CACHE_BYTES,
min_addr, max_addr, min_addr, max_addr,
NUMA_NO_NODE); NUMA_NO_NODE);
rgn_end = rgn->base + rgn->size; rgn_end = rgn->base + rgn->size;
...@@ -205,7 +216,7 @@ static int alloc_try_nid_exact_address_generic_check(void) ...@@ -205,7 +216,7 @@ static int alloc_try_nid_exact_address_generic_check(void)
* Expect to drop the lower limit and allocate a memory region which * Expect to drop the lower limit and allocate a memory region which
* ends at max_addr (if the address is aligned). * ends at max_addr (if the address is aligned).
*/ */
static int alloc_try_nid_top_down_narrow_range_check(void) static int alloc_nid_top_down_narrow_range_check(void)
{ {
struct memblock_region *rgn = &memblock.reserved.regions[0]; struct memblock_region *rgn = &memblock.reserved.regions[0];
void *allocated_ptr = NULL; void *allocated_ptr = NULL;
...@@ -219,7 +230,7 @@ static int alloc_try_nid_top_down_narrow_range_check(void) ...@@ -219,7 +230,7 @@ static int alloc_try_nid_top_down_narrow_range_check(void)
min_addr = memblock_start_of_DRAM() + SZ_512; min_addr = memblock_start_of_DRAM() + SZ_512;
max_addr = min_addr + SMP_CACHE_BYTES; max_addr = min_addr + SMP_CACHE_BYTES;
allocated_ptr = run_memblock_alloc_try_nid(size, SMP_CACHE_BYTES, allocated_ptr = run_memblock_alloc_nid(size, SMP_CACHE_BYTES,
min_addr, max_addr, min_addr, max_addr,
NUMA_NO_NODE); NUMA_NO_NODE);
...@@ -257,7 +268,7 @@ static int alloc_try_nid_top_down_narrow_range_check(void) ...@@ -257,7 +268,7 @@ static int alloc_try_nid_top_down_narrow_range_check(void)
* *
* Expect no allocation to happen. * Expect no allocation to happen.
*/ */
static int alloc_try_nid_low_max_generic_check(void) static int alloc_nid_low_max_generic_check(void)
{ {
void *allocated_ptr = NULL; void *allocated_ptr = NULL;
phys_addr_t size = SZ_1K; phys_addr_t size = SZ_1K;
...@@ -270,7 +281,7 @@ static int alloc_try_nid_low_max_generic_check(void) ...@@ -270,7 +281,7 @@ static int alloc_try_nid_low_max_generic_check(void)
min_addr = memblock_start_of_DRAM(); min_addr = memblock_start_of_DRAM();
max_addr = min_addr + SMP_CACHE_BYTES; max_addr = min_addr + SMP_CACHE_BYTES;
allocated_ptr = run_memblock_alloc_try_nid(size, SMP_CACHE_BYTES, allocated_ptr = run_memblock_alloc_nid(size, SMP_CACHE_BYTES,
min_addr, max_addr, min_addr, max_addr,
NUMA_NO_NODE); NUMA_NO_NODE);
...@@ -295,7 +306,7 @@ static int alloc_try_nid_low_max_generic_check(void) ...@@ -295,7 +306,7 @@ static int alloc_try_nid_low_max_generic_check(void)
* *
* Expect a merge of both regions. Only the region size gets updated. * Expect a merge of both regions. Only the region size gets updated.
*/ */
static int alloc_try_nid_min_reserved_generic_check(void) static int alloc_nid_min_reserved_generic_check(void)
{ {
struct memblock_region *rgn = &memblock.reserved.regions[0]; struct memblock_region *rgn = &memblock.reserved.regions[0];
void *allocated_ptr = NULL; void *allocated_ptr = NULL;
...@@ -315,7 +326,7 @@ static int alloc_try_nid_min_reserved_generic_check(void) ...@@ -315,7 +326,7 @@ static int alloc_try_nid_min_reserved_generic_check(void)
memblock_reserve(reserved_base, r1_size); memblock_reserve(reserved_base, r1_size);
allocated_ptr = run_memblock_alloc_try_nid(r2_size, SMP_CACHE_BYTES, allocated_ptr = run_memblock_alloc_nid(r2_size, SMP_CACHE_BYTES,
min_addr, max_addr, min_addr, max_addr,
NUMA_NO_NODE); NUMA_NO_NODE);
...@@ -347,7 +358,7 @@ static int alloc_try_nid_min_reserved_generic_check(void) ...@@ -347,7 +358,7 @@ static int alloc_try_nid_min_reserved_generic_check(void)
* *
* Expect a merge of regions. Only the region size gets updated. * Expect a merge of regions. Only the region size gets updated.
*/ */
static int alloc_try_nid_max_reserved_generic_check(void) static int alloc_nid_max_reserved_generic_check(void)
{ {
struct memblock_region *rgn = &memblock.reserved.regions[0]; struct memblock_region *rgn = &memblock.reserved.regions[0];
void *allocated_ptr = NULL; void *allocated_ptr = NULL;
...@@ -365,7 +376,7 @@ static int alloc_try_nid_max_reserved_generic_check(void) ...@@ -365,7 +376,7 @@ static int alloc_try_nid_max_reserved_generic_check(void)
memblock_reserve(max_addr, r1_size); memblock_reserve(max_addr, r1_size);
allocated_ptr = run_memblock_alloc_try_nid(r2_size, SMP_CACHE_BYTES, allocated_ptr = run_memblock_alloc_nid(r2_size, SMP_CACHE_BYTES,
min_addr, max_addr, min_addr, max_addr,
NUMA_NO_NODE); NUMA_NO_NODE);
...@@ -400,7 +411,7 @@ static int alloc_try_nid_max_reserved_generic_check(void) ...@@ -400,7 +411,7 @@ static int alloc_try_nid_max_reserved_generic_check(void)
* updated. The total size field gets updated. * updated. The total size field gets updated.
*/ */
static int alloc_try_nid_top_down_reserved_with_space_check(void) static int alloc_nid_top_down_reserved_with_space_check(void)
{ {
struct memblock_region *rgn1 = &memblock.reserved.regions[1]; struct memblock_region *rgn1 = &memblock.reserved.regions[1];
struct memblock_region *rgn2 = &memblock.reserved.regions[0]; struct memblock_region *rgn2 = &memblock.reserved.regions[0];
...@@ -428,7 +439,7 @@ static int alloc_try_nid_top_down_reserved_with_space_check(void) ...@@ -428,7 +439,7 @@ static int alloc_try_nid_top_down_reserved_with_space_check(void)
memblock_reserve(r1.base, r1.size); memblock_reserve(r1.base, r1.size);
memblock_reserve(r2.base, r2.size); memblock_reserve(r2.base, r2.size);
allocated_ptr = run_memblock_alloc_try_nid(r3_size, SMP_CACHE_BYTES, allocated_ptr = run_memblock_alloc_nid(r3_size, SMP_CACHE_BYTES,
min_addr, max_addr, min_addr, max_addr,
NUMA_NO_NODE); NUMA_NO_NODE);
...@@ -465,7 +476,7 @@ static int alloc_try_nid_top_down_reserved_with_space_check(void) ...@@ -465,7 +476,7 @@ static int alloc_try_nid_top_down_reserved_with_space_check(void)
* Expect to merge all of the regions into one. The region counter and total * Expect to merge all of the regions into one. The region counter and total
* size fields get updated. * size fields get updated.
*/ */
static int alloc_try_nid_reserved_full_merge_generic_check(void) static int alloc_nid_reserved_full_merge_generic_check(void)
{ {
struct memblock_region *rgn = &memblock.reserved.regions[0]; struct memblock_region *rgn = &memblock.reserved.regions[0];
void *allocated_ptr = NULL; void *allocated_ptr = NULL;
...@@ -491,7 +502,7 @@ static int alloc_try_nid_reserved_full_merge_generic_check(void) ...@@ -491,7 +502,7 @@ static int alloc_try_nid_reserved_full_merge_generic_check(void)
memblock_reserve(r1.base, r1.size); memblock_reserve(r1.base, r1.size);
memblock_reserve(r2.base, r2.size); memblock_reserve(r2.base, r2.size);
allocated_ptr = run_memblock_alloc_try_nid(r3_size, SMP_CACHE_BYTES, allocated_ptr = run_memblock_alloc_nid(r3_size, SMP_CACHE_BYTES,
min_addr, max_addr, min_addr, max_addr,
NUMA_NO_NODE); NUMA_NO_NODE);
...@@ -527,7 +538,7 @@ static int alloc_try_nid_reserved_full_merge_generic_check(void) ...@@ -527,7 +538,7 @@ static int alloc_try_nid_reserved_full_merge_generic_check(void)
* Expect to merge the new region with r2. The second region does not get * Expect to merge the new region with r2. The second region does not get
* updated. The total size counter gets updated. * updated. The total size counter gets updated.
*/ */
static int alloc_try_nid_top_down_reserved_no_space_check(void) static int alloc_nid_top_down_reserved_no_space_check(void)
{ {
struct memblock_region *rgn1 = &memblock.reserved.regions[1]; struct memblock_region *rgn1 = &memblock.reserved.regions[1];
struct memblock_region *rgn2 = &memblock.reserved.regions[0]; struct memblock_region *rgn2 = &memblock.reserved.regions[0];
...@@ -555,7 +566,7 @@ static int alloc_try_nid_top_down_reserved_no_space_check(void) ...@@ -555,7 +566,7 @@ static int alloc_try_nid_top_down_reserved_no_space_check(void)
memblock_reserve(r1.base, r1.size); memblock_reserve(r1.base, r1.size);
memblock_reserve(r2.base, r2.size); memblock_reserve(r2.base, r2.size);
allocated_ptr = run_memblock_alloc_try_nid(r3_size, SMP_CACHE_BYTES, allocated_ptr = run_memblock_alloc_nid(r3_size, SMP_CACHE_BYTES,
min_addr, max_addr, min_addr, max_addr,
NUMA_NO_NODE); NUMA_NO_NODE);
...@@ -596,7 +607,7 @@ static int alloc_try_nid_top_down_reserved_no_space_check(void) ...@@ -596,7 +607,7 @@ static int alloc_try_nid_top_down_reserved_no_space_check(void)
* Expect no allocation to happen. * Expect no allocation to happen.
*/ */
static int alloc_try_nid_reserved_all_generic_check(void) static int alloc_nid_reserved_all_generic_check(void)
{ {
void *allocated_ptr = NULL; void *allocated_ptr = NULL;
struct region r1, r2; struct region r1, r2;
...@@ -620,7 +631,7 @@ static int alloc_try_nid_reserved_all_generic_check(void) ...@@ -620,7 +631,7 @@ static int alloc_try_nid_reserved_all_generic_check(void)
memblock_reserve(r1.base, r1.size); memblock_reserve(r1.base, r1.size);
memblock_reserve(r2.base, r2.size); memblock_reserve(r2.base, r2.size);
allocated_ptr = run_memblock_alloc_try_nid(r3_size, SMP_CACHE_BYTES, allocated_ptr = run_memblock_alloc_nid(r3_size, SMP_CACHE_BYTES,
min_addr, max_addr, min_addr, max_addr,
NUMA_NO_NODE); NUMA_NO_NODE);
...@@ -636,7 +647,7 @@ static int alloc_try_nid_reserved_all_generic_check(void) ...@@ -636,7 +647,7 @@ static int alloc_try_nid_reserved_all_generic_check(void)
* bigger than the end address of the available memory. Expect to allocate * bigger than the end address of the available memory. Expect to allocate
* a region that ends before the end of the memory. * a region that ends before the end of the memory.
*/ */
static int alloc_try_nid_top_down_cap_max_check(void) static int alloc_nid_top_down_cap_max_check(void)
{ {
struct memblock_region *rgn = &memblock.reserved.regions[0]; struct memblock_region *rgn = &memblock.reserved.regions[0];
void *allocated_ptr = NULL; void *allocated_ptr = NULL;
...@@ -650,7 +661,7 @@ static int alloc_try_nid_top_down_cap_max_check(void) ...@@ -650,7 +661,7 @@ static int alloc_try_nid_top_down_cap_max_check(void)
min_addr = memblock_end_of_DRAM() - SZ_1K; min_addr = memblock_end_of_DRAM() - SZ_1K;
max_addr = memblock_end_of_DRAM() + SZ_256; max_addr = memblock_end_of_DRAM() + SZ_256;
allocated_ptr = run_memblock_alloc_try_nid(size, SMP_CACHE_BYTES, allocated_ptr = run_memblock_alloc_nid(size, SMP_CACHE_BYTES,
min_addr, max_addr, min_addr, max_addr,
NUMA_NO_NODE); NUMA_NO_NODE);
...@@ -673,7 +684,7 @@ static int alloc_try_nid_top_down_cap_max_check(void) ...@@ -673,7 +684,7 @@ static int alloc_try_nid_top_down_cap_max_check(void)
* smaller than the start address of the available memory. Expect to allocate * smaller than the start address of the available memory. Expect to allocate
* a region that ends before the end of the memory. * a region that ends before the end of the memory.
*/ */
static int alloc_try_nid_top_down_cap_min_check(void) static int alloc_nid_top_down_cap_min_check(void)
{ {
struct memblock_region *rgn = &memblock.reserved.regions[0]; struct memblock_region *rgn = &memblock.reserved.regions[0];
void *allocated_ptr = NULL; void *allocated_ptr = NULL;
...@@ -687,7 +698,7 @@ static int alloc_try_nid_top_down_cap_min_check(void) ...@@ -687,7 +698,7 @@ static int alloc_try_nid_top_down_cap_min_check(void)
min_addr = memblock_start_of_DRAM() - SZ_256; min_addr = memblock_start_of_DRAM() - SZ_256;
max_addr = memblock_end_of_DRAM(); max_addr = memblock_end_of_DRAM();
allocated_ptr = run_memblock_alloc_try_nid(size, SMP_CACHE_BYTES, allocated_ptr = run_memblock_alloc_nid(size, SMP_CACHE_BYTES,
min_addr, max_addr, min_addr, max_addr,
NUMA_NO_NODE); NUMA_NO_NODE);
...@@ -719,7 +730,7 @@ static int alloc_try_nid_top_down_cap_min_check(void) ...@@ -719,7 +730,7 @@ static int alloc_try_nid_top_down_cap_min_check(void)
* *
* Expect to allocate a region that ends before max_addr. * Expect to allocate a region that ends before max_addr.
*/ */
static int alloc_try_nid_bottom_up_simple_check(void) static int alloc_nid_bottom_up_simple_check(void)
{ {
struct memblock_region *rgn = &memblock.reserved.regions[0]; struct memblock_region *rgn = &memblock.reserved.regions[0];
void *allocated_ptr = NULL; void *allocated_ptr = NULL;
...@@ -734,7 +745,7 @@ static int alloc_try_nid_bottom_up_simple_check(void) ...@@ -734,7 +745,7 @@ static int alloc_try_nid_bottom_up_simple_check(void)
min_addr = memblock_start_of_DRAM() + SMP_CACHE_BYTES * 2; min_addr = memblock_start_of_DRAM() + SMP_CACHE_BYTES * 2;
max_addr = min_addr + SZ_512; max_addr = min_addr + SZ_512;
allocated_ptr = run_memblock_alloc_try_nid(size, SMP_CACHE_BYTES, allocated_ptr = run_memblock_alloc_nid(size, SMP_CACHE_BYTES,
min_addr, max_addr, min_addr, max_addr,
NUMA_NO_NODE); NUMA_NO_NODE);
rgn_end = rgn->base + rgn->size; rgn_end = rgn->base + rgn->size;
...@@ -771,7 +782,7 @@ static int alloc_try_nid_bottom_up_simple_check(void) ...@@ -771,7 +782,7 @@ static int alloc_try_nid_bottom_up_simple_check(void)
* *
* Expect to allocate an aligned region that ends before max_addr. * Expect to allocate an aligned region that ends before max_addr.
*/ */
static int alloc_try_nid_bottom_up_start_misaligned_check(void) static int alloc_nid_bottom_up_start_misaligned_check(void)
{ {
struct memblock_region *rgn = &memblock.reserved.regions[0]; struct memblock_region *rgn = &memblock.reserved.regions[0];
void *allocated_ptr = NULL; void *allocated_ptr = NULL;
...@@ -787,7 +798,7 @@ static int alloc_try_nid_bottom_up_start_misaligned_check(void) ...@@ -787,7 +798,7 @@ static int alloc_try_nid_bottom_up_start_misaligned_check(void)
min_addr = memblock_start_of_DRAM() + misalign; min_addr = memblock_start_of_DRAM() + misalign;
max_addr = min_addr + SZ_512; max_addr = min_addr + SZ_512;
allocated_ptr = run_memblock_alloc_try_nid(size, SMP_CACHE_BYTES, allocated_ptr = run_memblock_alloc_nid(size, SMP_CACHE_BYTES,
min_addr, max_addr, min_addr, max_addr,
NUMA_NO_NODE); NUMA_NO_NODE);
rgn_end = rgn->base + rgn->size; rgn_end = rgn->base + rgn->size;
...@@ -824,7 +835,7 @@ static int alloc_try_nid_bottom_up_start_misaligned_check(void) ...@@ -824,7 +835,7 @@ static int alloc_try_nid_bottom_up_start_misaligned_check(void)
* Expect to drop the lower limit and allocate a memory region which * Expect to drop the lower limit and allocate a memory region which
* starts at the beginning of the available memory. * starts at the beginning of the available memory.
*/ */
static int alloc_try_nid_bottom_up_narrow_range_check(void) static int alloc_nid_bottom_up_narrow_range_check(void)
{ {
struct memblock_region *rgn = &memblock.reserved.regions[0]; struct memblock_region *rgn = &memblock.reserved.regions[0];
void *allocated_ptr = NULL; void *allocated_ptr = NULL;
...@@ -838,7 +849,7 @@ static int alloc_try_nid_bottom_up_narrow_range_check(void) ...@@ -838,7 +849,7 @@ static int alloc_try_nid_bottom_up_narrow_range_check(void)
min_addr = memblock_start_of_DRAM() + SZ_512; min_addr = memblock_start_of_DRAM() + SZ_512;
max_addr = min_addr + SMP_CACHE_BYTES; max_addr = min_addr + SMP_CACHE_BYTES;
allocated_ptr = run_memblock_alloc_try_nid(size, SMP_CACHE_BYTES, allocated_ptr = run_memblock_alloc_nid(size, SMP_CACHE_BYTES,
min_addr, max_addr, min_addr, max_addr,
NUMA_NO_NODE); NUMA_NO_NODE);
...@@ -873,7 +884,7 @@ static int alloc_try_nid_bottom_up_narrow_range_check(void) ...@@ -873,7 +884,7 @@ static int alloc_try_nid_bottom_up_narrow_range_check(void)
* updated. The total size field gets updated. * updated. The total size field gets updated.
*/ */
static int alloc_try_nid_bottom_up_reserved_with_space_check(void) static int alloc_nid_bottom_up_reserved_with_space_check(void)
{ {
struct memblock_region *rgn1 = &memblock.reserved.regions[1]; struct memblock_region *rgn1 = &memblock.reserved.regions[1];
struct memblock_region *rgn2 = &memblock.reserved.regions[0]; struct memblock_region *rgn2 = &memblock.reserved.regions[0];
...@@ -901,7 +912,7 @@ static int alloc_try_nid_bottom_up_reserved_with_space_check(void) ...@@ -901,7 +912,7 @@ static int alloc_try_nid_bottom_up_reserved_with_space_check(void)
memblock_reserve(r1.base, r1.size); memblock_reserve(r1.base, r1.size);
memblock_reserve(r2.base, r2.size); memblock_reserve(r2.base, r2.size);
allocated_ptr = run_memblock_alloc_try_nid(r3_size, SMP_CACHE_BYTES, allocated_ptr = run_memblock_alloc_nid(r3_size, SMP_CACHE_BYTES,
min_addr, max_addr, min_addr, max_addr,
NUMA_NO_NODE); NUMA_NO_NODE);
...@@ -942,7 +953,7 @@ static int alloc_try_nid_bottom_up_reserved_with_space_check(void) ...@@ -942,7 +953,7 @@ static int alloc_try_nid_bottom_up_reserved_with_space_check(void)
* Other regions are not modified. * Other regions are not modified.
*/ */
static int alloc_try_nid_bottom_up_reserved_no_space_check(void) static int alloc_nid_bottom_up_reserved_no_space_check(void)
{ {
struct memblock_region *rgn1 = &memblock.reserved.regions[2]; struct memblock_region *rgn1 = &memblock.reserved.regions[2];
struct memblock_region *rgn2 = &memblock.reserved.regions[1]; struct memblock_region *rgn2 = &memblock.reserved.regions[1];
...@@ -971,7 +982,7 @@ static int alloc_try_nid_bottom_up_reserved_no_space_check(void) ...@@ -971,7 +982,7 @@ static int alloc_try_nid_bottom_up_reserved_no_space_check(void)
memblock_reserve(r1.base, r1.size); memblock_reserve(r1.base, r1.size);
memblock_reserve(r2.base, r2.size); memblock_reserve(r2.base, r2.size);
allocated_ptr = run_memblock_alloc_try_nid(r3_size, SMP_CACHE_BYTES, allocated_ptr = run_memblock_alloc_nid(r3_size, SMP_CACHE_BYTES,
min_addr, max_addr, min_addr, max_addr,
NUMA_NO_NODE); NUMA_NO_NODE);
...@@ -1000,7 +1011,7 @@ static int alloc_try_nid_bottom_up_reserved_no_space_check(void) ...@@ -1000,7 +1011,7 @@ static int alloc_try_nid_bottom_up_reserved_no_space_check(void)
* bigger than the end address of the available memory. Expect to allocate * bigger than the end address of the available memory. Expect to allocate
* a region that starts at the min_addr. * a region that starts at the min_addr.
*/ */
static int alloc_try_nid_bottom_up_cap_max_check(void) static int alloc_nid_bottom_up_cap_max_check(void)
{ {
struct memblock_region *rgn = &memblock.reserved.regions[0]; struct memblock_region *rgn = &memblock.reserved.regions[0];
void *allocated_ptr = NULL; void *allocated_ptr = NULL;
...@@ -1014,7 +1025,7 @@ static int alloc_try_nid_bottom_up_cap_max_check(void) ...@@ -1014,7 +1025,7 @@ static int alloc_try_nid_bottom_up_cap_max_check(void)
min_addr = memblock_start_of_DRAM() + SZ_1K; min_addr = memblock_start_of_DRAM() + SZ_1K;
max_addr = memblock_end_of_DRAM() + SZ_256; max_addr = memblock_end_of_DRAM() + SZ_256;
allocated_ptr = run_memblock_alloc_try_nid(size, SMP_CACHE_BYTES, allocated_ptr = run_memblock_alloc_nid(size, SMP_CACHE_BYTES,
min_addr, max_addr, min_addr, max_addr,
NUMA_NO_NODE); NUMA_NO_NODE);
...@@ -1037,7 +1048,7 @@ static int alloc_try_nid_bottom_up_cap_max_check(void) ...@@ -1037,7 +1048,7 @@ static int alloc_try_nid_bottom_up_cap_max_check(void)
* smaller than the start address of the available memory. Expect to allocate * smaller than the start address of the available memory. Expect to allocate
* a region at the beginning of the available memory. * a region at the beginning of the available memory.
*/ */
static int alloc_try_nid_bottom_up_cap_min_check(void) static int alloc_nid_bottom_up_cap_min_check(void)
{ {
struct memblock_region *rgn = &memblock.reserved.regions[0]; struct memblock_region *rgn = &memblock.reserved.regions[0];
void *allocated_ptr = NULL; void *allocated_ptr = NULL;
...@@ -1051,7 +1062,7 @@ static int alloc_try_nid_bottom_up_cap_min_check(void) ...@@ -1051,7 +1062,7 @@ static int alloc_try_nid_bottom_up_cap_min_check(void)
min_addr = memblock_start_of_DRAM(); min_addr = memblock_start_of_DRAM();
max_addr = memblock_end_of_DRAM() - SZ_256; max_addr = memblock_end_of_DRAM() - SZ_256;
allocated_ptr = run_memblock_alloc_try_nid(size, SMP_CACHE_BYTES, allocated_ptr = run_memblock_alloc_nid(size, SMP_CACHE_BYTES,
min_addr, max_addr, min_addr, max_addr,
NUMA_NO_NODE); NUMA_NO_NODE);
...@@ -1070,133 +1081,133 @@ static int alloc_try_nid_bottom_up_cap_min_check(void) ...@@ -1070,133 +1081,133 @@ static int alloc_try_nid_bottom_up_cap_min_check(void)
} }
/* Test case wrappers for range tests */ /* Test case wrappers for range tests */
static int alloc_try_nid_simple_check(void) static int alloc_nid_simple_check(void)
{ {
test_print("\tRunning %s...\n", __func__); test_print("\tRunning %s...\n", __func__);
memblock_set_bottom_up(false); memblock_set_bottom_up(false);
alloc_try_nid_top_down_simple_check(); alloc_nid_top_down_simple_check();
memblock_set_bottom_up(true); memblock_set_bottom_up(true);
alloc_try_nid_bottom_up_simple_check(); alloc_nid_bottom_up_simple_check();
return 0; return 0;
} }
static int alloc_try_nid_misaligned_check(void) static int alloc_nid_misaligned_check(void)
{ {
test_print("\tRunning %s...\n", __func__); test_print("\tRunning %s...\n", __func__);
memblock_set_bottom_up(false); memblock_set_bottom_up(false);
alloc_try_nid_top_down_end_misaligned_check(); alloc_nid_top_down_end_misaligned_check();
memblock_set_bottom_up(true); memblock_set_bottom_up(true);
alloc_try_nid_bottom_up_start_misaligned_check(); alloc_nid_bottom_up_start_misaligned_check();
return 0; return 0;
} }
static int alloc_try_nid_narrow_range_check(void) static int alloc_nid_narrow_range_check(void)
{ {
test_print("\tRunning %s...\n", __func__); test_print("\tRunning %s...\n", __func__);
memblock_set_bottom_up(false); memblock_set_bottom_up(false);
alloc_try_nid_top_down_narrow_range_check(); alloc_nid_top_down_narrow_range_check();
memblock_set_bottom_up(true); memblock_set_bottom_up(true);
alloc_try_nid_bottom_up_narrow_range_check(); alloc_nid_bottom_up_narrow_range_check();
return 0; return 0;
} }
static int alloc_try_nid_reserved_with_space_check(void) static int alloc_nid_reserved_with_space_check(void)
{ {
test_print("\tRunning %s...\n", __func__); test_print("\tRunning %s...\n", __func__);
memblock_set_bottom_up(false); memblock_set_bottom_up(false);
alloc_try_nid_top_down_reserved_with_space_check(); alloc_nid_top_down_reserved_with_space_check();
memblock_set_bottom_up(true); memblock_set_bottom_up(true);
alloc_try_nid_bottom_up_reserved_with_space_check(); alloc_nid_bottom_up_reserved_with_space_check();
return 0; return 0;
} }
static int alloc_try_nid_reserved_no_space_check(void) static int alloc_nid_reserved_no_space_check(void)
{ {
test_print("\tRunning %s...\n", __func__); test_print("\tRunning %s...\n", __func__);
memblock_set_bottom_up(false); memblock_set_bottom_up(false);
alloc_try_nid_top_down_reserved_no_space_check(); alloc_nid_top_down_reserved_no_space_check();
memblock_set_bottom_up(true); memblock_set_bottom_up(true);
alloc_try_nid_bottom_up_reserved_no_space_check(); alloc_nid_bottom_up_reserved_no_space_check();
return 0; return 0;
} }
static int alloc_try_nid_cap_max_check(void) static int alloc_nid_cap_max_check(void)
{ {
test_print("\tRunning %s...\n", __func__); test_print("\tRunning %s...\n", __func__);
memblock_set_bottom_up(false); memblock_set_bottom_up(false);
alloc_try_nid_top_down_cap_max_check(); alloc_nid_top_down_cap_max_check();
memblock_set_bottom_up(true); memblock_set_bottom_up(true);
alloc_try_nid_bottom_up_cap_max_check(); alloc_nid_bottom_up_cap_max_check();
return 0; return 0;
} }
static int alloc_try_nid_cap_min_check(void) static int alloc_nid_cap_min_check(void)
{ {
test_print("\tRunning %s...\n", __func__); test_print("\tRunning %s...\n", __func__);
memblock_set_bottom_up(false); memblock_set_bottom_up(false);
alloc_try_nid_top_down_cap_min_check(); alloc_nid_top_down_cap_min_check();
memblock_set_bottom_up(true); memblock_set_bottom_up(true);
alloc_try_nid_bottom_up_cap_min_check(); alloc_nid_bottom_up_cap_min_check();
return 0; return 0;
} }
static int alloc_try_nid_min_reserved_check(void) static int alloc_nid_min_reserved_check(void)
{ {
test_print("\tRunning %s...\n", __func__); test_print("\tRunning %s...\n", __func__);
run_top_down(alloc_try_nid_min_reserved_generic_check); run_top_down(alloc_nid_min_reserved_generic_check);
run_bottom_up(alloc_try_nid_min_reserved_generic_check); run_bottom_up(alloc_nid_min_reserved_generic_check);
return 0; return 0;
} }
static int alloc_try_nid_max_reserved_check(void) static int alloc_nid_max_reserved_check(void)
{ {
test_print("\tRunning %s...\n", __func__); test_print("\tRunning %s...\n", __func__);
run_top_down(alloc_try_nid_max_reserved_generic_check); run_top_down(alloc_nid_max_reserved_generic_check);
run_bottom_up(alloc_try_nid_max_reserved_generic_check); run_bottom_up(alloc_nid_max_reserved_generic_check);
return 0; return 0;
} }
static int alloc_try_nid_exact_address_check(void) static int alloc_nid_exact_address_check(void)
{ {
test_print("\tRunning %s...\n", __func__); test_print("\tRunning %s...\n", __func__);
run_top_down(alloc_try_nid_exact_address_generic_check); run_top_down(alloc_nid_exact_address_generic_check);
run_bottom_up(alloc_try_nid_exact_address_generic_check); run_bottom_up(alloc_nid_exact_address_generic_check);
return 0; return 0;
} }
static int alloc_try_nid_reserved_full_merge_check(void) static int alloc_nid_reserved_full_merge_check(void)
{ {
test_print("\tRunning %s...\n", __func__); test_print("\tRunning %s...\n", __func__);
run_top_down(alloc_try_nid_reserved_full_merge_generic_check); run_top_down(alloc_nid_reserved_full_merge_generic_check);
run_bottom_up(alloc_try_nid_reserved_full_merge_generic_check); run_bottom_up(alloc_nid_reserved_full_merge_generic_check);
return 0; return 0;
} }
static int alloc_try_nid_reserved_all_check(void) static int alloc_nid_reserved_all_check(void)
{ {
test_print("\tRunning %s...\n", __func__); test_print("\tRunning %s...\n", __func__);
run_top_down(alloc_try_nid_reserved_all_generic_check); run_top_down(alloc_nid_reserved_all_generic_check);
run_bottom_up(alloc_try_nid_reserved_all_generic_check); run_bottom_up(alloc_nid_reserved_all_generic_check);
return 0; return 0;
} }
static int alloc_try_nid_low_max_check(void) static int alloc_nid_low_max_check(void)
{ {
test_print("\tRunning %s...\n", __func__); test_print("\tRunning %s...\n", __func__);
run_top_down(alloc_try_nid_low_max_generic_check); run_top_down(alloc_nid_low_max_generic_check);
run_bottom_up(alloc_try_nid_low_max_generic_check); run_bottom_up(alloc_nid_low_max_generic_check);
return 0; return 0;
} }
...@@ -1204,22 +1215,22 @@ static int alloc_try_nid_low_max_check(void) ...@@ -1204,22 +1215,22 @@ static int alloc_try_nid_low_max_check(void)
static int memblock_alloc_nid_range_checks(void) static int memblock_alloc_nid_range_checks(void)
{ {
test_print("Running %s range tests...\n", test_print("Running %s range tests...\n",
get_memblock_alloc_try_nid_name(alloc_nid_test_flags)); get_memblock_alloc_nid_name(alloc_nid_test_flags));
alloc_try_nid_simple_check(); alloc_nid_simple_check();
alloc_try_nid_misaligned_check(); alloc_nid_misaligned_check();
alloc_try_nid_narrow_range_check(); alloc_nid_narrow_range_check();
alloc_try_nid_reserved_with_space_check(); alloc_nid_reserved_with_space_check();
alloc_try_nid_reserved_no_space_check(); alloc_nid_reserved_no_space_check();
alloc_try_nid_cap_max_check(); alloc_nid_cap_max_check();
alloc_try_nid_cap_min_check(); alloc_nid_cap_min_check();
alloc_try_nid_min_reserved_check(); alloc_nid_min_reserved_check();
alloc_try_nid_max_reserved_check(); alloc_nid_max_reserved_check();
alloc_try_nid_exact_address_check(); alloc_nid_exact_address_check();
alloc_try_nid_reserved_full_merge_check(); alloc_nid_reserved_full_merge_check();
alloc_try_nid_reserved_all_check(); alloc_nid_reserved_all_check();
alloc_try_nid_low_max_check(); alloc_nid_low_max_check();
return 0; return 0;
} }
...@@ -1229,7 +1240,7 @@ static int memblock_alloc_nid_range_checks(void) ...@@ -1229,7 +1240,7 @@ static int memblock_alloc_nid_range_checks(void)
* has enough memory to allocate a region of the requested size. * has enough memory to allocate a region of the requested size.
* Expect to allocate an aligned region at the end of the requested node. * Expect to allocate an aligned region at the end of the requested node.
*/ */
static int alloc_try_nid_top_down_numa_simple_check(void) static int alloc_nid_top_down_numa_simple_check(void)
{ {
int nid_req = 3; int nid_req = 3;
struct memblock_region *new_rgn = &memblock.reserved.regions[0]; struct memblock_region *new_rgn = &memblock.reserved.regions[0];
...@@ -1247,7 +1258,7 @@ static int alloc_try_nid_top_down_numa_simple_check(void) ...@@ -1247,7 +1258,7 @@ static int alloc_try_nid_top_down_numa_simple_check(void)
min_addr = memblock_start_of_DRAM(); min_addr = memblock_start_of_DRAM();
max_addr = memblock_end_of_DRAM(); max_addr = memblock_end_of_DRAM();
allocated_ptr = run_memblock_alloc_try_nid(size, SMP_CACHE_BYTES, allocated_ptr = run_memblock_alloc_nid(size, SMP_CACHE_BYTES,
min_addr, max_addr, nid_req); min_addr, max_addr, nid_req);
ASSERT_NE(allocated_ptr, NULL); ASSERT_NE(allocated_ptr, NULL);
...@@ -1280,7 +1291,7 @@ static int alloc_try_nid_top_down_numa_simple_check(void) ...@@ -1280,7 +1291,7 @@ static int alloc_try_nid_top_down_numa_simple_check(void)
* Expect to allocate an aligned region at the end of the last node that has * Expect to allocate an aligned region at the end of the last node that has
* enough memory (in this case, nid = 6) after falling back to NUMA_NO_NODE. * enough memory (in this case, nid = 6) after falling back to NUMA_NO_NODE.
*/ */
static int alloc_try_nid_top_down_numa_small_node_check(void) static int alloc_nid_top_down_numa_small_node_check(void)
{ {
int nid_req = 1; int nid_req = 1;
int nid_exp = 6; int nid_exp = 6;
...@@ -1299,7 +1310,7 @@ static int alloc_try_nid_top_down_numa_small_node_check(void) ...@@ -1299,7 +1310,7 @@ static int alloc_try_nid_top_down_numa_small_node_check(void)
min_addr = memblock_start_of_DRAM(); min_addr = memblock_start_of_DRAM();
max_addr = memblock_end_of_DRAM(); max_addr = memblock_end_of_DRAM();
allocated_ptr = run_memblock_alloc_try_nid(size, SMP_CACHE_BYTES, allocated_ptr = run_memblock_alloc_nid(size, SMP_CACHE_BYTES,
min_addr, max_addr, nid_req); min_addr, max_addr, nid_req);
ASSERT_NE(allocated_ptr, NULL); ASSERT_NE(allocated_ptr, NULL);
...@@ -1333,7 +1344,7 @@ static int alloc_try_nid_top_down_numa_small_node_check(void) ...@@ -1333,7 +1344,7 @@ static int alloc_try_nid_top_down_numa_small_node_check(void)
* large enough and has enough unreserved memory (in this case, nid = 6) after * large enough and has enough unreserved memory (in this case, nid = 6) after
* falling back to NUMA_NO_NODE. The region count and total size get updated. * falling back to NUMA_NO_NODE. The region count and total size get updated.
*/ */
static int alloc_try_nid_top_down_numa_node_reserved_check(void) static int alloc_nid_top_down_numa_node_reserved_check(void)
{ {
int nid_req = 2; int nid_req = 2;
int nid_exp = 6; int nid_exp = 6;
...@@ -1353,7 +1364,7 @@ static int alloc_try_nid_top_down_numa_node_reserved_check(void) ...@@ -1353,7 +1364,7 @@ static int alloc_try_nid_top_down_numa_node_reserved_check(void)
max_addr = memblock_end_of_DRAM(); max_addr = memblock_end_of_DRAM();
memblock_reserve(req_node->base, req_node->size); memblock_reserve(req_node->base, req_node->size);
allocated_ptr = run_memblock_alloc_try_nid(size, SMP_CACHE_BYTES, allocated_ptr = run_memblock_alloc_nid(size, SMP_CACHE_BYTES,
min_addr, max_addr, nid_req); min_addr, max_addr, nid_req);
ASSERT_NE(allocated_ptr, NULL); ASSERT_NE(allocated_ptr, NULL);
...@@ -1386,7 +1397,7 @@ static int alloc_try_nid_top_down_numa_node_reserved_check(void) ...@@ -1386,7 +1397,7 @@ static int alloc_try_nid_top_down_numa_node_reserved_check(void)
* Expect to allocate an aligned region at the end of the requested node. The * Expect to allocate an aligned region at the end of the requested node. The
* region count and total size get updated. * region count and total size get updated.
*/ */
static int alloc_try_nid_top_down_numa_part_reserved_check(void) static int alloc_nid_top_down_numa_part_reserved_check(void)
{ {
int nid_req = 4; int nid_req = 4;
struct memblock_region *new_rgn = &memblock.reserved.regions[1]; struct memblock_region *new_rgn = &memblock.reserved.regions[1];
...@@ -1408,7 +1419,7 @@ static int alloc_try_nid_top_down_numa_part_reserved_check(void) ...@@ -1408,7 +1419,7 @@ static int alloc_try_nid_top_down_numa_part_reserved_check(void)
max_addr = memblock_end_of_DRAM(); max_addr = memblock_end_of_DRAM();
memblock_reserve(r1.base, r1.size); memblock_reserve(r1.base, r1.size);
allocated_ptr = run_memblock_alloc_try_nid(size, SMP_CACHE_BYTES, allocated_ptr = run_memblock_alloc_nid(size, SMP_CACHE_BYTES,
min_addr, max_addr, nid_req); min_addr, max_addr, nid_req);
ASSERT_NE(allocated_ptr, NULL); ASSERT_NE(allocated_ptr, NULL);
...@@ -1444,7 +1455,7 @@ static int alloc_try_nid_top_down_numa_part_reserved_check(void) ...@@ -1444,7 +1455,7 @@ static int alloc_try_nid_top_down_numa_part_reserved_check(void)
* nid = NUMA_NODES - 1) after falling back to NUMA_NO_NODE. The region count * nid = NUMA_NODES - 1) after falling back to NUMA_NO_NODE. The region count
* and total size get updated. * and total size get updated.
*/ */
static int alloc_try_nid_top_down_numa_part_reserved_fallback_check(void) static int alloc_nid_top_down_numa_part_reserved_fallback_check(void)
{ {
int nid_req = 4; int nid_req = 4;
int nid_exp = NUMA_NODES - 1; int nid_exp = NUMA_NODES - 1;
...@@ -1469,7 +1480,7 @@ static int alloc_try_nid_top_down_numa_part_reserved_fallback_check(void) ...@@ -1469,7 +1480,7 @@ static int alloc_try_nid_top_down_numa_part_reserved_fallback_check(void)
max_addr = memblock_end_of_DRAM(); max_addr = memblock_end_of_DRAM();
memblock_reserve(r1.base, r1.size); memblock_reserve(r1.base, r1.size);
allocated_ptr = run_memblock_alloc_try_nid(size, SMP_CACHE_BYTES, allocated_ptr = run_memblock_alloc_nid(size, SMP_CACHE_BYTES,
min_addr, max_addr, nid_req); min_addr, max_addr, nid_req);
ASSERT_NE(allocated_ptr, NULL); ASSERT_NE(allocated_ptr, NULL);
...@@ -1507,7 +1518,7 @@ static int alloc_try_nid_top_down_numa_part_reserved_fallback_check(void) ...@@ -1507,7 +1518,7 @@ static int alloc_try_nid_top_down_numa_part_reserved_fallback_check(void)
* Expect to drop the lower limit and allocate a memory region that ends at * Expect to drop the lower limit and allocate a memory region that ends at
* the end of the requested node. * the end of the requested node.
*/ */
static int alloc_try_nid_top_down_numa_split_range_low_check(void) static int alloc_nid_top_down_numa_split_range_low_check(void)
{ {
int nid_req = 2; int nid_req = 2;
struct memblock_region *new_rgn = &memblock.reserved.regions[0]; struct memblock_region *new_rgn = &memblock.reserved.regions[0];
...@@ -1525,7 +1536,7 @@ static int alloc_try_nid_top_down_numa_split_range_low_check(void) ...@@ -1525,7 +1536,7 @@ static int alloc_try_nid_top_down_numa_split_range_low_check(void)
min_addr = req_node_end - SZ_256; min_addr = req_node_end - SZ_256;
max_addr = min_addr + size; max_addr = min_addr + size;
allocated_ptr = run_memblock_alloc_try_nid(size, SMP_CACHE_BYTES, allocated_ptr = run_memblock_alloc_nid(size, SMP_CACHE_BYTES,
min_addr, max_addr, nid_req); min_addr, max_addr, nid_req);
ASSERT_NE(allocated_ptr, NULL); ASSERT_NE(allocated_ptr, NULL);
...@@ -1563,7 +1574,7 @@ static int alloc_try_nid_top_down_numa_split_range_low_check(void) ...@@ -1563,7 +1574,7 @@ static int alloc_try_nid_top_down_numa_split_range_low_check(void)
* Expect to drop the lower limit and allocate a memory region that * Expect to drop the lower limit and allocate a memory region that
* ends at the end of the first node that overlaps with the range. * ends at the end of the first node that overlaps with the range.
*/ */
static int alloc_try_nid_top_down_numa_split_range_high_check(void) static int alloc_nid_top_down_numa_split_range_high_check(void)
{ {
int nid_req = 3; int nid_req = 3;
int nid_exp = nid_req - 1; int nid_exp = nid_req - 1;
...@@ -1582,7 +1593,7 @@ static int alloc_try_nid_top_down_numa_split_range_high_check(void) ...@@ -1582,7 +1593,7 @@ static int alloc_try_nid_top_down_numa_split_range_high_check(void)
min_addr = exp_node_end - SZ_256; min_addr = exp_node_end - SZ_256;
max_addr = min_addr + size; max_addr = min_addr + size;
allocated_ptr = run_memblock_alloc_try_nid(size, SMP_CACHE_BYTES, allocated_ptr = run_memblock_alloc_nid(size, SMP_CACHE_BYTES,
min_addr, max_addr, nid_req); min_addr, max_addr, nid_req);
ASSERT_NE(allocated_ptr, NULL); ASSERT_NE(allocated_ptr, NULL);
...@@ -1620,7 +1631,7 @@ static int alloc_try_nid_top_down_numa_split_range_high_check(void) ...@@ -1620,7 +1631,7 @@ static int alloc_try_nid_top_down_numa_split_range_high_check(void)
* Expect to drop the lower limit and allocate a memory region that ends at * Expect to drop the lower limit and allocate a memory region that ends at
* the end of the requested node. * the end of the requested node.
*/ */
static int alloc_try_nid_top_down_numa_no_overlap_split_check(void) static int alloc_nid_top_down_numa_no_overlap_split_check(void)
{ {
int nid_req = 2; int nid_req = 2;
struct memblock_region *new_rgn = &memblock.reserved.regions[0]; struct memblock_region *new_rgn = &memblock.reserved.regions[0];
...@@ -1638,7 +1649,7 @@ static int alloc_try_nid_top_down_numa_no_overlap_split_check(void) ...@@ -1638,7 +1649,7 @@ static int alloc_try_nid_top_down_numa_no_overlap_split_check(void)
min_addr = node2->base - SZ_256; min_addr = node2->base - SZ_256;
max_addr = min_addr + size; max_addr = min_addr + size;
allocated_ptr = run_memblock_alloc_try_nid(size, SMP_CACHE_BYTES, allocated_ptr = run_memblock_alloc_nid(size, SMP_CACHE_BYTES,
min_addr, max_addr, nid_req); min_addr, max_addr, nid_req);
ASSERT_NE(allocated_ptr, NULL); ASSERT_NE(allocated_ptr, NULL);
...@@ -1677,7 +1688,7 @@ static int alloc_try_nid_top_down_numa_no_overlap_split_check(void) ...@@ -1677,7 +1688,7 @@ static int alloc_try_nid_top_down_numa_no_overlap_split_check(void)
* Expect to allocate a memory region at the end of the final node in * Expect to allocate a memory region at the end of the final node in
* the range after falling back to NUMA_NO_NODE. * the range after falling back to NUMA_NO_NODE.
*/ */
static int alloc_try_nid_top_down_numa_no_overlap_low_check(void) static int alloc_nid_top_down_numa_no_overlap_low_check(void)
{ {
int nid_req = 0; int nid_req = 0;
struct memblock_region *new_rgn = &memblock.reserved.regions[0]; struct memblock_region *new_rgn = &memblock.reserved.regions[0];
...@@ -1694,7 +1705,7 @@ static int alloc_try_nid_top_down_numa_no_overlap_low_check(void) ...@@ -1694,7 +1705,7 @@ static int alloc_try_nid_top_down_numa_no_overlap_low_check(void)
min_addr = min_node->base; min_addr = min_node->base;
max_addr = region_end(max_node); max_addr = region_end(max_node);
allocated_ptr = run_memblock_alloc_try_nid(size, SMP_CACHE_BYTES, allocated_ptr = run_memblock_alloc_nid(size, SMP_CACHE_BYTES,
min_addr, max_addr, nid_req); min_addr, max_addr, nid_req);
ASSERT_NE(allocated_ptr, NULL); ASSERT_NE(allocated_ptr, NULL);
...@@ -1733,7 +1744,7 @@ static int alloc_try_nid_top_down_numa_no_overlap_low_check(void) ...@@ -1733,7 +1744,7 @@ static int alloc_try_nid_top_down_numa_no_overlap_low_check(void)
* Expect to allocate a memory region at the end of the final node in * Expect to allocate a memory region at the end of the final node in
* the range after falling back to NUMA_NO_NODE. * the range after falling back to NUMA_NO_NODE.
*/ */
static int alloc_try_nid_top_down_numa_no_overlap_high_check(void) static int alloc_nid_top_down_numa_no_overlap_high_check(void)
{ {
int nid_req = 7; int nid_req = 7;
struct memblock_region *new_rgn = &memblock.reserved.regions[0]; struct memblock_region *new_rgn = &memblock.reserved.regions[0];
...@@ -1750,7 +1761,7 @@ static int alloc_try_nid_top_down_numa_no_overlap_high_check(void) ...@@ -1750,7 +1761,7 @@ static int alloc_try_nid_top_down_numa_no_overlap_high_check(void)
min_addr = min_node->base; min_addr = min_node->base;
max_addr = region_end(max_node); max_addr = region_end(max_node);
allocated_ptr = run_memblock_alloc_try_nid(size, SMP_CACHE_BYTES, allocated_ptr = run_memblock_alloc_nid(size, SMP_CACHE_BYTES,
min_addr, max_addr, nid_req); min_addr, max_addr, nid_req);
ASSERT_NE(allocated_ptr, NULL); ASSERT_NE(allocated_ptr, NULL);
...@@ -1773,7 +1784,7 @@ static int alloc_try_nid_top_down_numa_no_overlap_high_check(void) ...@@ -1773,7 +1784,7 @@ static int alloc_try_nid_top_down_numa_no_overlap_high_check(void)
* has enough memory to allocate a region of the requested size. * has enough memory to allocate a region of the requested size.
* Expect to allocate an aligned region at the beginning of the requested node. * Expect to allocate an aligned region at the beginning of the requested node.
*/ */
static int alloc_try_nid_bottom_up_numa_simple_check(void) static int alloc_nid_bottom_up_numa_simple_check(void)
{ {
int nid_req = 3; int nid_req = 3;
struct memblock_region *new_rgn = &memblock.reserved.regions[0]; struct memblock_region *new_rgn = &memblock.reserved.regions[0];
...@@ -1791,7 +1802,7 @@ static int alloc_try_nid_bottom_up_numa_simple_check(void) ...@@ -1791,7 +1802,7 @@ static int alloc_try_nid_bottom_up_numa_simple_check(void)
min_addr = memblock_start_of_DRAM(); min_addr = memblock_start_of_DRAM();
max_addr = memblock_end_of_DRAM(); max_addr = memblock_end_of_DRAM();
allocated_ptr = run_memblock_alloc_try_nid(size, SMP_CACHE_BYTES, allocated_ptr = run_memblock_alloc_nid(size, SMP_CACHE_BYTES,
min_addr, max_addr, nid_req); min_addr, max_addr, nid_req);
ASSERT_NE(allocated_ptr, NULL); ASSERT_NE(allocated_ptr, NULL);
...@@ -1824,7 +1835,7 @@ static int alloc_try_nid_bottom_up_numa_simple_check(void) ...@@ -1824,7 +1835,7 @@ static int alloc_try_nid_bottom_up_numa_simple_check(void)
* Expect to allocate an aligned region at the beginning of the first node that * Expect to allocate an aligned region at the beginning of the first node that
* has enough memory (in this case, nid = 0) after falling back to NUMA_NO_NODE. * has enough memory (in this case, nid = 0) after falling back to NUMA_NO_NODE.
*/ */
static int alloc_try_nid_bottom_up_numa_small_node_check(void) static int alloc_nid_bottom_up_numa_small_node_check(void)
{ {
int nid_req = 1; int nid_req = 1;
int nid_exp = 0; int nid_exp = 0;
...@@ -1843,7 +1854,7 @@ static int alloc_try_nid_bottom_up_numa_small_node_check(void) ...@@ -1843,7 +1854,7 @@ static int alloc_try_nid_bottom_up_numa_small_node_check(void)
min_addr = memblock_start_of_DRAM(); min_addr = memblock_start_of_DRAM();
max_addr = memblock_end_of_DRAM(); max_addr = memblock_end_of_DRAM();
allocated_ptr = run_memblock_alloc_try_nid(size, SMP_CACHE_BYTES, allocated_ptr = run_memblock_alloc_nid(size, SMP_CACHE_BYTES,
min_addr, max_addr, nid_req); min_addr, max_addr, nid_req);
ASSERT_NE(allocated_ptr, NULL); ASSERT_NE(allocated_ptr, NULL);
...@@ -1878,7 +1889,7 @@ static int alloc_try_nid_bottom_up_numa_small_node_check(void) ...@@ -1878,7 +1889,7 @@ static int alloc_try_nid_bottom_up_numa_small_node_check(void)
* after falling back to NUMA_NO_NODE. The region count and total size get * after falling back to NUMA_NO_NODE. The region count and total size get
* updated. * updated.
*/ */
static int alloc_try_nid_bottom_up_numa_node_reserved_check(void) static int alloc_nid_bottom_up_numa_node_reserved_check(void)
{ {
int nid_req = 2; int nid_req = 2;
int nid_exp = 0; int nid_exp = 0;
...@@ -1898,7 +1909,7 @@ static int alloc_try_nid_bottom_up_numa_node_reserved_check(void) ...@@ -1898,7 +1909,7 @@ static int alloc_try_nid_bottom_up_numa_node_reserved_check(void)
max_addr = memblock_end_of_DRAM(); max_addr = memblock_end_of_DRAM();
memblock_reserve(req_node->base, req_node->size); memblock_reserve(req_node->base, req_node->size);
allocated_ptr = run_memblock_alloc_try_nid(size, SMP_CACHE_BYTES, allocated_ptr = run_memblock_alloc_nid(size, SMP_CACHE_BYTES,
min_addr, max_addr, nid_req); min_addr, max_addr, nid_req);
ASSERT_NE(allocated_ptr, NULL); ASSERT_NE(allocated_ptr, NULL);
...@@ -1931,7 +1942,7 @@ static int alloc_try_nid_bottom_up_numa_node_reserved_check(void) ...@@ -1931,7 +1942,7 @@ static int alloc_try_nid_bottom_up_numa_node_reserved_check(void)
* Expect to allocate an aligned region in the requested node that merges with * Expect to allocate an aligned region in the requested node that merges with
* the existing reserved region. The total size gets updated. * the existing reserved region. The total size gets updated.
*/ */
static int alloc_try_nid_bottom_up_numa_part_reserved_check(void) static int alloc_nid_bottom_up_numa_part_reserved_check(void)
{ {
int nid_req = 4; int nid_req = 4;
struct memblock_region *new_rgn = &memblock.reserved.regions[0]; struct memblock_region *new_rgn = &memblock.reserved.regions[0];
...@@ -1955,7 +1966,7 @@ static int alloc_try_nid_bottom_up_numa_part_reserved_check(void) ...@@ -1955,7 +1966,7 @@ static int alloc_try_nid_bottom_up_numa_part_reserved_check(void)
total_size = size + r1.size; total_size = size + r1.size;
memblock_reserve(r1.base, r1.size); memblock_reserve(r1.base, r1.size);
allocated_ptr = run_memblock_alloc_try_nid(size, SMP_CACHE_BYTES, allocated_ptr = run_memblock_alloc_nid(size, SMP_CACHE_BYTES,
min_addr, max_addr, nid_req); min_addr, max_addr, nid_req);
ASSERT_NE(allocated_ptr, NULL); ASSERT_NE(allocated_ptr, NULL);
...@@ -1991,7 +2002,7 @@ static int alloc_try_nid_bottom_up_numa_part_reserved_check(void) ...@@ -1991,7 +2002,7 @@ static int alloc_try_nid_bottom_up_numa_part_reserved_check(void)
* nid = 0) after falling back to NUMA_NO_NODE. The region count and total size * nid = 0) after falling back to NUMA_NO_NODE. The region count and total size
* get updated. * get updated.
*/ */
static int alloc_try_nid_bottom_up_numa_part_reserved_fallback_check(void) static int alloc_nid_bottom_up_numa_part_reserved_fallback_check(void)
{ {
int nid_req = 4; int nid_req = 4;
int nid_exp = 0; int nid_exp = 0;
...@@ -2016,7 +2027,7 @@ static int alloc_try_nid_bottom_up_numa_part_reserved_fallback_check(void) ...@@ -2016,7 +2027,7 @@ static int alloc_try_nid_bottom_up_numa_part_reserved_fallback_check(void)
max_addr = memblock_end_of_DRAM(); max_addr = memblock_end_of_DRAM();
memblock_reserve(r1.base, r1.size); memblock_reserve(r1.base, r1.size);
allocated_ptr = run_memblock_alloc_try_nid(size, SMP_CACHE_BYTES, allocated_ptr = run_memblock_alloc_nid(size, SMP_CACHE_BYTES,
min_addr, max_addr, nid_req); min_addr, max_addr, nid_req);
ASSERT_NE(allocated_ptr, NULL); ASSERT_NE(allocated_ptr, NULL);
...@@ -2054,7 +2065,7 @@ static int alloc_try_nid_bottom_up_numa_part_reserved_fallback_check(void) ...@@ -2054,7 +2065,7 @@ static int alloc_try_nid_bottom_up_numa_part_reserved_fallback_check(void)
* Expect to drop the lower limit and allocate a memory region at the beginning * Expect to drop the lower limit and allocate a memory region at the beginning
* of the requested node. * of the requested node.
*/ */
static int alloc_try_nid_bottom_up_numa_split_range_low_check(void) static int alloc_nid_bottom_up_numa_split_range_low_check(void)
{ {
int nid_req = 2; int nid_req = 2;
struct memblock_region *new_rgn = &memblock.reserved.regions[0]; struct memblock_region *new_rgn = &memblock.reserved.regions[0];
...@@ -2072,7 +2083,7 @@ static int alloc_try_nid_bottom_up_numa_split_range_low_check(void) ...@@ -2072,7 +2083,7 @@ static int alloc_try_nid_bottom_up_numa_split_range_low_check(void)
min_addr = req_node_end - SZ_256; min_addr = req_node_end - SZ_256;
max_addr = min_addr + size; max_addr = min_addr + size;
allocated_ptr = run_memblock_alloc_try_nid(size, SMP_CACHE_BYTES, allocated_ptr = run_memblock_alloc_nid(size, SMP_CACHE_BYTES,
min_addr, max_addr, nid_req); min_addr, max_addr, nid_req);
ASSERT_NE(allocated_ptr, NULL); ASSERT_NE(allocated_ptr, NULL);
...@@ -2110,7 +2121,7 @@ static int alloc_try_nid_bottom_up_numa_split_range_low_check(void) ...@@ -2110,7 +2121,7 @@ static int alloc_try_nid_bottom_up_numa_split_range_low_check(void)
* Expect to drop the lower limit and allocate a memory region at the beginning * Expect to drop the lower limit and allocate a memory region at the beginning
* of the first node that has enough memory. * of the first node that has enough memory.
*/ */
static int alloc_try_nid_bottom_up_numa_split_range_high_check(void) static int alloc_nid_bottom_up_numa_split_range_high_check(void)
{ {
int nid_req = 3; int nid_req = 3;
int nid_exp = 0; int nid_exp = 0;
...@@ -2130,7 +2141,7 @@ static int alloc_try_nid_bottom_up_numa_split_range_high_check(void) ...@@ -2130,7 +2141,7 @@ static int alloc_try_nid_bottom_up_numa_split_range_high_check(void)
min_addr = req_node->base - SZ_256; min_addr = req_node->base - SZ_256;
max_addr = min_addr + size; max_addr = min_addr + size;
allocated_ptr = run_memblock_alloc_try_nid(size, SMP_CACHE_BYTES, allocated_ptr = run_memblock_alloc_nid(size, SMP_CACHE_BYTES,
min_addr, max_addr, nid_req); min_addr, max_addr, nid_req);
ASSERT_NE(allocated_ptr, NULL); ASSERT_NE(allocated_ptr, NULL);
...@@ -2168,7 +2179,7 @@ static int alloc_try_nid_bottom_up_numa_split_range_high_check(void) ...@@ -2168,7 +2179,7 @@ static int alloc_try_nid_bottom_up_numa_split_range_high_check(void)
* Expect to drop the lower limit and allocate a memory region that starts at * Expect to drop the lower limit and allocate a memory region that starts at
* the beginning of the requested node. * the beginning of the requested node.
*/ */
static int alloc_try_nid_bottom_up_numa_no_overlap_split_check(void) static int alloc_nid_bottom_up_numa_no_overlap_split_check(void)
{ {
int nid_req = 2; int nid_req = 2;
struct memblock_region *new_rgn = &memblock.reserved.regions[0]; struct memblock_region *new_rgn = &memblock.reserved.regions[0];
...@@ -2186,7 +2197,7 @@ static int alloc_try_nid_bottom_up_numa_no_overlap_split_check(void) ...@@ -2186,7 +2197,7 @@ static int alloc_try_nid_bottom_up_numa_no_overlap_split_check(void)
min_addr = node2->base - SZ_256; min_addr = node2->base - SZ_256;
max_addr = min_addr + size; max_addr = min_addr + size;
allocated_ptr = run_memblock_alloc_try_nid(size, SMP_CACHE_BYTES, allocated_ptr = run_memblock_alloc_nid(size, SMP_CACHE_BYTES,
min_addr, max_addr, nid_req); min_addr, max_addr, nid_req);
ASSERT_NE(allocated_ptr, NULL); ASSERT_NE(allocated_ptr, NULL);
...@@ -2225,7 +2236,7 @@ static int alloc_try_nid_bottom_up_numa_no_overlap_split_check(void) ...@@ -2225,7 +2236,7 @@ static int alloc_try_nid_bottom_up_numa_no_overlap_split_check(void)
* Expect to allocate a memory region at the beginning of the first node * Expect to allocate a memory region at the beginning of the first node
* in the range after falling back to NUMA_NO_NODE. * in the range after falling back to NUMA_NO_NODE.
*/ */
static int alloc_try_nid_bottom_up_numa_no_overlap_low_check(void) static int alloc_nid_bottom_up_numa_no_overlap_low_check(void)
{ {
int nid_req = 0; int nid_req = 0;
struct memblock_region *new_rgn = &memblock.reserved.regions[0]; struct memblock_region *new_rgn = &memblock.reserved.regions[0];
...@@ -2242,7 +2253,7 @@ static int alloc_try_nid_bottom_up_numa_no_overlap_low_check(void) ...@@ -2242,7 +2253,7 @@ static int alloc_try_nid_bottom_up_numa_no_overlap_low_check(void)
min_addr = min_node->base; min_addr = min_node->base;
max_addr = region_end(max_node); max_addr = region_end(max_node);
allocated_ptr = run_memblock_alloc_try_nid(size, SMP_CACHE_BYTES, allocated_ptr = run_memblock_alloc_nid(size, SMP_CACHE_BYTES,
min_addr, max_addr, nid_req); min_addr, max_addr, nid_req);
ASSERT_NE(allocated_ptr, NULL); ASSERT_NE(allocated_ptr, NULL);
...@@ -2281,7 +2292,7 @@ static int alloc_try_nid_bottom_up_numa_no_overlap_low_check(void) ...@@ -2281,7 +2292,7 @@ static int alloc_try_nid_bottom_up_numa_no_overlap_low_check(void)
* Expect to allocate a memory region at the beginning of the first node * Expect to allocate a memory region at the beginning of the first node
* in the range after falling back to NUMA_NO_NODE. * in the range after falling back to NUMA_NO_NODE.
*/ */
static int alloc_try_nid_bottom_up_numa_no_overlap_high_check(void) static int alloc_nid_bottom_up_numa_no_overlap_high_check(void)
{ {
int nid_req = 7; int nid_req = 7;
struct memblock_region *new_rgn = &memblock.reserved.regions[0]; struct memblock_region *new_rgn = &memblock.reserved.regions[0];
...@@ -2298,7 +2309,7 @@ static int alloc_try_nid_bottom_up_numa_no_overlap_high_check(void) ...@@ -2298,7 +2309,7 @@ static int alloc_try_nid_bottom_up_numa_no_overlap_high_check(void)
min_addr = min_node->base; min_addr = min_node->base;
max_addr = region_end(max_node); max_addr = region_end(max_node);
allocated_ptr = run_memblock_alloc_try_nid(size, SMP_CACHE_BYTES, allocated_ptr = run_memblock_alloc_nid(size, SMP_CACHE_BYTES,
min_addr, max_addr, nid_req); min_addr, max_addr, nid_req);
ASSERT_NE(allocated_ptr, NULL); ASSERT_NE(allocated_ptr, NULL);
...@@ -2330,7 +2341,7 @@ static int alloc_try_nid_bottom_up_numa_no_overlap_high_check(void) ...@@ -2330,7 +2341,7 @@ static int alloc_try_nid_bottom_up_numa_no_overlap_high_check(void)
* *
* Expect no allocation to happen. * Expect no allocation to happen.
*/ */
static int alloc_try_nid_numa_large_region_generic_check(void) static int alloc_nid_numa_large_region_generic_check(void)
{ {
int nid_req = 3; int nid_req = 3;
void *allocated_ptr = NULL; void *allocated_ptr = NULL;
...@@ -2344,7 +2355,7 @@ static int alloc_try_nid_numa_large_region_generic_check(void) ...@@ -2344,7 +2355,7 @@ static int alloc_try_nid_numa_large_region_generic_check(void)
min_addr = memblock_start_of_DRAM(); min_addr = memblock_start_of_DRAM();
max_addr = memblock_end_of_DRAM(); max_addr = memblock_end_of_DRAM();
allocated_ptr = run_memblock_alloc_try_nid(size, SMP_CACHE_BYTES, allocated_ptr = run_memblock_alloc_nid(size, SMP_CACHE_BYTES,
min_addr, max_addr, nid_req); min_addr, max_addr, nid_req);
ASSERT_EQ(allocated_ptr, NULL); ASSERT_EQ(allocated_ptr, NULL);
...@@ -2374,7 +2385,7 @@ static int alloc_try_nid_numa_large_region_generic_check(void) ...@@ -2374,7 +2385,7 @@ static int alloc_try_nid_numa_large_region_generic_check(void)
* Expect to merge all of the regions into one. The region counter and total * Expect to merge all of the regions into one. The region counter and total
* size fields get updated. * size fields get updated.
*/ */
static int alloc_try_nid_numa_reserved_full_merge_generic_check(void) static int alloc_nid_numa_reserved_full_merge_generic_check(void)
{ {
int nid_req = 6; int nid_req = 6;
int nid_next = nid_req + 1; int nid_next = nid_req + 1;
...@@ -2404,7 +2415,7 @@ static int alloc_try_nid_numa_reserved_full_merge_generic_check(void) ...@@ -2404,7 +2415,7 @@ static int alloc_try_nid_numa_reserved_full_merge_generic_check(void)
memblock_reserve(r1.base, r1.size); memblock_reserve(r1.base, r1.size);
memblock_reserve(r2.base, r2.size); memblock_reserve(r2.base, r2.size);
allocated_ptr = run_memblock_alloc_try_nid(size, SMP_CACHE_BYTES, allocated_ptr = run_memblock_alloc_nid(size, SMP_CACHE_BYTES,
min_addr, max_addr, nid_req); min_addr, max_addr, nid_req);
ASSERT_NE(allocated_ptr, NULL); ASSERT_NE(allocated_ptr, NULL);
...@@ -2448,7 +2459,7 @@ static int alloc_try_nid_numa_reserved_full_merge_generic_check(void) ...@@ -2448,7 +2459,7 @@ static int alloc_try_nid_numa_reserved_full_merge_generic_check(void)
* *
* Expect no allocation to happen. * Expect no allocation to happen.
*/ */
static int alloc_try_nid_numa_split_all_reserved_generic_check(void) static int alloc_nid_numa_split_all_reserved_generic_check(void)
{ {
void *allocated_ptr = NULL; void *allocated_ptr = NULL;
struct memblock_region *next_node = &memblock.memory.regions[7]; struct memblock_region *next_node = &memblock.memory.regions[7];
...@@ -2472,7 +2483,7 @@ static int alloc_try_nid_numa_split_all_reserved_generic_check(void) ...@@ -2472,7 +2483,7 @@ static int alloc_try_nid_numa_split_all_reserved_generic_check(void)
memblock_reserve(r1.base, r1.size); memblock_reserve(r1.base, r1.size);
memblock_reserve(r2.base, r2.size); memblock_reserve(r2.base, r2.size);
allocated_ptr = run_memblock_alloc_try_nid(size, SMP_CACHE_BYTES, allocated_ptr = run_memblock_alloc_nid(size, SMP_CACHE_BYTES,
min_addr, max_addr, min_addr, max_addr,
NUMA_NO_NODE); NUMA_NO_NODE);
...@@ -2484,139 +2495,139 @@ static int alloc_try_nid_numa_split_all_reserved_generic_check(void) ...@@ -2484,139 +2495,139 @@ static int alloc_try_nid_numa_split_all_reserved_generic_check(void)
} }
/* Test case wrappers for NUMA tests */ /* Test case wrappers for NUMA tests */
static int alloc_try_nid_numa_simple_check(void) static int alloc_nid_numa_simple_check(void)
{ {
test_print("\tRunning %s...\n", __func__); test_print("\tRunning %s...\n", __func__);
memblock_set_bottom_up(false); memblock_set_bottom_up(false);
alloc_try_nid_top_down_numa_simple_check(); alloc_nid_top_down_numa_simple_check();
memblock_set_bottom_up(true); memblock_set_bottom_up(true);
alloc_try_nid_bottom_up_numa_simple_check(); alloc_nid_bottom_up_numa_simple_check();
return 0; return 0;
} }
static int alloc_try_nid_numa_small_node_check(void) static int alloc_nid_numa_small_node_check(void)
{ {
test_print("\tRunning %s...\n", __func__); test_print("\tRunning %s...\n", __func__);
memblock_set_bottom_up(false); memblock_set_bottom_up(false);
alloc_try_nid_top_down_numa_small_node_check(); alloc_nid_top_down_numa_small_node_check();
memblock_set_bottom_up(true); memblock_set_bottom_up(true);
alloc_try_nid_bottom_up_numa_small_node_check(); alloc_nid_bottom_up_numa_small_node_check();
return 0; return 0;
} }
static int alloc_try_nid_numa_node_reserved_check(void) static int alloc_nid_numa_node_reserved_check(void)
{ {
test_print("\tRunning %s...\n", __func__); test_print("\tRunning %s...\n", __func__);
memblock_set_bottom_up(false); memblock_set_bottom_up(false);
alloc_try_nid_top_down_numa_node_reserved_check(); alloc_nid_top_down_numa_node_reserved_check();
memblock_set_bottom_up(true); memblock_set_bottom_up(true);
alloc_try_nid_bottom_up_numa_node_reserved_check(); alloc_nid_bottom_up_numa_node_reserved_check();
return 0; return 0;
} }
static int alloc_try_nid_numa_part_reserved_check(void) static int alloc_nid_numa_part_reserved_check(void)
{ {
test_print("\tRunning %s...\n", __func__); test_print("\tRunning %s...\n", __func__);
memblock_set_bottom_up(false); memblock_set_bottom_up(false);
alloc_try_nid_top_down_numa_part_reserved_check(); alloc_nid_top_down_numa_part_reserved_check();
memblock_set_bottom_up(true); memblock_set_bottom_up(true);
alloc_try_nid_bottom_up_numa_part_reserved_check(); alloc_nid_bottom_up_numa_part_reserved_check();
return 0; return 0;
} }
static int alloc_try_nid_numa_part_reserved_fallback_check(void) static int alloc_nid_numa_part_reserved_fallback_check(void)
{ {
test_print("\tRunning %s...\n", __func__); test_print("\tRunning %s...\n", __func__);
memblock_set_bottom_up(false); memblock_set_bottom_up(false);
alloc_try_nid_top_down_numa_part_reserved_fallback_check(); alloc_nid_top_down_numa_part_reserved_fallback_check();
memblock_set_bottom_up(true); memblock_set_bottom_up(true);
alloc_try_nid_bottom_up_numa_part_reserved_fallback_check(); alloc_nid_bottom_up_numa_part_reserved_fallback_check();
return 0; return 0;
} }
static int alloc_try_nid_numa_split_range_low_check(void) static int alloc_nid_numa_split_range_low_check(void)
{ {
test_print("\tRunning %s...\n", __func__); test_print("\tRunning %s...\n", __func__);
memblock_set_bottom_up(false); memblock_set_bottom_up(false);
alloc_try_nid_top_down_numa_split_range_low_check(); alloc_nid_top_down_numa_split_range_low_check();
memblock_set_bottom_up(true); memblock_set_bottom_up(true);
alloc_try_nid_bottom_up_numa_split_range_low_check(); alloc_nid_bottom_up_numa_split_range_low_check();
return 0; return 0;
} }
static int alloc_try_nid_numa_split_range_high_check(void) static int alloc_nid_numa_split_range_high_check(void)
{ {
test_print("\tRunning %s...\n", __func__); test_print("\tRunning %s...\n", __func__);
memblock_set_bottom_up(false); memblock_set_bottom_up(false);
alloc_try_nid_top_down_numa_split_range_high_check(); alloc_nid_top_down_numa_split_range_high_check();
memblock_set_bottom_up(true); memblock_set_bottom_up(true);
alloc_try_nid_bottom_up_numa_split_range_high_check(); alloc_nid_bottom_up_numa_split_range_high_check();
return 0; return 0;
} }
static int alloc_try_nid_numa_no_overlap_split_check(void) static int alloc_nid_numa_no_overlap_split_check(void)
{ {
test_print("\tRunning %s...\n", __func__); test_print("\tRunning %s...\n", __func__);
memblock_set_bottom_up(false); memblock_set_bottom_up(false);
alloc_try_nid_top_down_numa_no_overlap_split_check(); alloc_nid_top_down_numa_no_overlap_split_check();
memblock_set_bottom_up(true); memblock_set_bottom_up(true);
alloc_try_nid_bottom_up_numa_no_overlap_split_check(); alloc_nid_bottom_up_numa_no_overlap_split_check();
return 0; return 0;
} }
static int alloc_try_nid_numa_no_overlap_low_check(void) static int alloc_nid_numa_no_overlap_low_check(void)
{ {
test_print("\tRunning %s...\n", __func__); test_print("\tRunning %s...\n", __func__);
memblock_set_bottom_up(false); memblock_set_bottom_up(false);
alloc_try_nid_top_down_numa_no_overlap_low_check(); alloc_nid_top_down_numa_no_overlap_low_check();
memblock_set_bottom_up(true); memblock_set_bottom_up(true);
alloc_try_nid_bottom_up_numa_no_overlap_low_check(); alloc_nid_bottom_up_numa_no_overlap_low_check();
return 0; return 0;
} }
static int alloc_try_nid_numa_no_overlap_high_check(void) static int alloc_nid_numa_no_overlap_high_check(void)
{ {
test_print("\tRunning %s...\n", __func__); test_print("\tRunning %s...\n", __func__);
memblock_set_bottom_up(false); memblock_set_bottom_up(false);
alloc_try_nid_top_down_numa_no_overlap_high_check(); alloc_nid_top_down_numa_no_overlap_high_check();
memblock_set_bottom_up(true); memblock_set_bottom_up(true);
alloc_try_nid_bottom_up_numa_no_overlap_high_check(); alloc_nid_bottom_up_numa_no_overlap_high_check();
return 0; return 0;
} }
static int alloc_try_nid_numa_large_region_check(void) static int alloc_nid_numa_large_region_check(void)
{ {
test_print("\tRunning %s...\n", __func__); test_print("\tRunning %s...\n", __func__);
run_top_down(alloc_try_nid_numa_large_region_generic_check); run_top_down(alloc_nid_numa_large_region_generic_check);
run_bottom_up(alloc_try_nid_numa_large_region_generic_check); run_bottom_up(alloc_nid_numa_large_region_generic_check);
return 0; return 0;
} }
static int alloc_try_nid_numa_reserved_full_merge_check(void) static int alloc_nid_numa_reserved_full_merge_check(void)
{ {
test_print("\tRunning %s...\n", __func__); test_print("\tRunning %s...\n", __func__);
run_top_down(alloc_try_nid_numa_reserved_full_merge_generic_check); run_top_down(alloc_nid_numa_reserved_full_merge_generic_check);
run_bottom_up(alloc_try_nid_numa_reserved_full_merge_generic_check); run_bottom_up(alloc_nid_numa_reserved_full_merge_generic_check);
return 0; return 0;
} }
static int alloc_try_nid_numa_split_all_reserved_check(void) static int alloc_nid_numa_split_all_reserved_check(void)
{ {
test_print("\tRunning %s...\n", __func__); test_print("\tRunning %s...\n", __func__);
run_top_down(alloc_try_nid_numa_split_all_reserved_generic_check); run_top_down(alloc_nid_numa_split_all_reserved_generic_check);
run_bottom_up(alloc_try_nid_numa_split_all_reserved_generic_check); run_bottom_up(alloc_nid_numa_split_all_reserved_generic_check);
return 0; return 0;
} }
...@@ -2624,22 +2635,22 @@ static int alloc_try_nid_numa_split_all_reserved_check(void) ...@@ -2624,22 +2635,22 @@ static int alloc_try_nid_numa_split_all_reserved_check(void)
int __memblock_alloc_nid_numa_checks(void) int __memblock_alloc_nid_numa_checks(void)
{ {
test_print("Running %s NUMA tests...\n", test_print("Running %s NUMA tests...\n",
get_memblock_alloc_try_nid_name(alloc_nid_test_flags)); get_memblock_alloc_nid_name(alloc_nid_test_flags));
alloc_try_nid_numa_simple_check(); alloc_nid_numa_simple_check();
alloc_try_nid_numa_small_node_check(); alloc_nid_numa_small_node_check();
alloc_try_nid_numa_node_reserved_check(); alloc_nid_numa_node_reserved_check();
alloc_try_nid_numa_part_reserved_check(); alloc_nid_numa_part_reserved_check();
alloc_try_nid_numa_part_reserved_fallback_check(); alloc_nid_numa_part_reserved_fallback_check();
alloc_try_nid_numa_split_range_low_check(); alloc_nid_numa_split_range_low_check();
alloc_try_nid_numa_split_range_high_check(); alloc_nid_numa_split_range_high_check();
alloc_try_nid_numa_no_overlap_split_check(); alloc_nid_numa_no_overlap_split_check();
alloc_try_nid_numa_no_overlap_low_check(); alloc_nid_numa_no_overlap_low_check();
alloc_try_nid_numa_no_overlap_high_check(); alloc_nid_numa_no_overlap_high_check();
alloc_try_nid_numa_large_region_check(); alloc_nid_numa_large_region_check();
alloc_try_nid_numa_reserved_full_merge_check(); alloc_nid_numa_reserved_full_merge_check();
alloc_try_nid_numa_split_all_reserved_check(); alloc_nid_numa_split_all_reserved_check();
return 0; return 0;
} }
...@@ -2649,7 +2660,7 @@ static int memblock_alloc_nid_checks_internal(int flags) ...@@ -2649,7 +2660,7 @@ static int memblock_alloc_nid_checks_internal(int flags)
alloc_nid_test_flags = flags; alloc_nid_test_flags = flags;
prefix_reset(); prefix_reset();
prefix_push(get_memblock_alloc_try_nid_name(flags)); prefix_push(get_memblock_alloc_nid_name(flags));
reset_memblock_attributes(); reset_memblock_attributes();
dummy_physical_memory_init(); dummy_physical_memory_init();
...@@ -2671,3 +2682,12 @@ int memblock_alloc_nid_checks(void) ...@@ -2671,3 +2682,12 @@ int memblock_alloc_nid_checks(void)
return 0; return 0;
} }
int memblock_alloc_exact_nid_range_checks(void)
{
alloc_nid_test_flags = (TEST_F_RAW | TEST_F_EXACT);
memblock_alloc_nid_range_checks();
return 0;
}
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include "common.h" #include "common.h"
int memblock_alloc_nid_checks(void); int memblock_alloc_nid_checks(void);
int memblock_alloc_exact_nid_range_checks(void);
int __memblock_alloc_nid_numa_checks(void); int __memblock_alloc_nid_numa_checks(void);
#ifdef CONFIG_NUMA #ifdef CONFIG_NUMA
......
...@@ -21,6 +21,8 @@ enum test_flags { ...@@ -21,6 +21,8 @@ enum test_flags {
TEST_F_NONE = 0x0, TEST_F_NONE = 0x0,
/* Perform raw allocations (no zeroing of memory). */ /* Perform raw allocations (no zeroing of memory). */
TEST_F_RAW = 0x1, TEST_F_RAW = 0x1,
/* Perform allocations on the exact node specified. */
TEST_F_EXACT = 0x2
}; };
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment