Commit ad76bf1f authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull memblock updates from Mike Rapoport:
 "Extend test coverage:

   - add tests that trigger reallocation of memblock structures from
     memblock itself via memblock_double_array()

   - add tests for memblock_alloc_exact_nid_raw() that verify that
     requested node and memory range constraints are respected"

* tag 'memblock-v6.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rppt/memblock:
  memblock tests: remove completed TODO item
  memblock tests: add generic NUMA tests for memblock_alloc_exact_nid_raw
  memblock tests: add bottom-up NUMA tests for memblock_alloc_exact_nid_raw
  memblock tests: add top-down NUMA tests for memblock_alloc_exact_nid_raw
  memblock tests: introduce range tests for memblock_alloc_exact_nid_raw
  memblock test: Update TODO list
  memblock test: Add test to memblock_reserve() 129th region
  memblock test: Add test to memblock_add() 129th region
parents 6f1f5cae 80c2fe02
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@ CFLAGS += -I. -I../../include -Wall -O2 -fsanitize=address \
LDFLAGS += -fsanitize=address -fsanitize=undefined
TARGETS = main
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
OFILES = main.o $(DEP_OFILES) $(TEST_OFILES)
EXTR_SRC = ../../../mm/memblock.c
+1 −13
Original line number Diff line number Diff line
TODO
=====

1. Add tests trying to memblock_add() or memblock_reserve() 129th region.
   This will trigger memblock_double_array(), make sure it succeeds.
   *Important:* These tests require valid memory ranges, use dummy physical
                memory block from common.c to implement them. It is also very
                likely that the current MEM_SIZE won't be enough for these
                test cases. Use realloc to adjust the size accordingly.

2. Add test cases using this functions (implement them for both directions):
   + memblock_alloc_raw()
   + memblock_alloc_exact_nid_raw()
   + memblock_alloc_try_nid_raw()

3. Add tests for memblock_alloc_node() to check if the correct NUMA node is set
1. Add tests for memblock_alloc_node() to check if the correct NUMA node is set
   for the new region
+2 −0
Original line number Diff line number Diff line
@@ -3,6 +3,7 @@
#include "tests/alloc_api.h"
#include "tests/alloc_helpers_api.h"
#include "tests/alloc_nid_api.h"
#include "tests/alloc_exact_nid_api.h"
#include "tests/common.h"

int main(int argc, char **argv)
@@ -12,6 +13,7 @@ int main(int argc, char **argv)
	memblock_alloc_checks();
	memblock_alloc_helpers_checks();
	memblock_alloc_nid_checks();
	memblock_alloc_exact_nid_checks();

	return 0;
}
+1113 −0

File added.

Preview size limit exceeded, changes collapsed.

+25 −0
Original line number Diff line number Diff line
/* 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);
int __memblock_alloc_exact_nid_numa_checks(void);

#ifdef CONFIG_NUMA
static inline int memblock_alloc_exact_nid_numa_checks(void)
{
	__memblock_alloc_exact_nid_numa_checks();
	return 0;
}

#else
static inline int memblock_alloc_exact_nid_numa_checks(void)
{
	return 0;
}

#endif /* CONFIG_NUMA */

#endif
Loading