memblock tests: add generic NUMA tests for memblock_alloc_try_nid*
authorRebecca Mckeever <remckee0@gmail.com>
Tue, 13 Sep 2022 05:21:12 +0000 (00:21 -0500)
committerMike Rapoport <rppt@linux.ibm.com>
Sun, 18 Sep 2022 07:30:20 +0000 (10:30 +0300)
commit3e4519b7afc2f9d99f9303468ee0b23f88399c8d
treefbdf4faecb8b855a1bdf7dde7f7b3edfa45e590c
parent4b41046e7c6bd999c1519a8bf2771573bcecf52b
memblock tests: add generic NUMA tests for memblock_alloc_try_nid*

Add tests for memblock_alloc_try_nid() and memblock_alloc_try_nid_raw()
where the simulated physical memory is set up with multiple NUMA nodes.
Additionally, two of these tests set nid != NUMA_NO_NODE. All tests are
run for both top-down and bottom-up allocation directions.

The tested scenarios are:

Range unrestricted:
- region cannot be allocated:
      + none of the nodes have enough memory to allocate the region

Range restricted:
- region can be allocated in the specific node requested without dropping
  min_addr:
      + the range fully overlaps with the node, and there are adjacent
        reserved regions
- region cannot be allocated:
      + nid is set to NUMA_NO_NODE and the total range can fit the region,
        but the range is split between two nodes and everything else is
        reserved

Acked-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Rebecca Mckeever <remckee0@gmail.com>
Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
Link: https://lore.kernel.org/r/4b2c7e6e5f3a9837939e99293c77e0e6fc3ae4f9.1663046060.git.remckee0@gmail.com
tools/testing/memblock/tests/alloc_nid_api.c