numa: Add new regression test for MPOL_PREFERRED poliy
PATCH v2 1/1 numa: Add new regression test for MPOL_PREFERRED poliy
Kernel bug description:
Allocating memory on node1 with MPOL_PREFERRED policy doesn't work with THP enabled, it always fallbacks to local node (ex. node0). This impacts workload performance for multi node systems.
It has been fixed by:
commit 0867a57c (mm, thp: respect MPOL_PREFERRED policy with non-local node)
Test on kernel without this patch:
12 TFAIL: NUMA memory allocated in node1 is less than expected
Test on kernel with this fix:
12 TPASS: NUMA preferred node policy verified with THP enabled
---
Notes:
v1 --> v2
* add transparent_hugepage/enabled check
* shrink the test memory from 1GB to 2HPAGE size
testcases/kernel/numa/README | 3 +++ testcases/kernel/numa/numa01.sh | 43 +++++++++++++++++++++++++++++++++++- testcases/kernel/numa/support_numa.c | 19 ++++++++++++++++ 3 files changed, 64 insertions(+), 1 deletion(-)
testcases/kernel/numa/README +3 -0
@@ -57,6 +57,9 @@ Verifieds the NUMA migratepages policy. TestCase11: Verifies the hugepage memory allocated from the node we specify. +TestCase12: +Verifies the preferred node policy with THP memory allocating from the node we specify. + Pre-requisites ==================================================================================================================== * libnuma should be installed on the NUMA machine before executing theses testcases
testcases/kernel/numa/numa01.sh +42 -1
56 lines not on this page · raw message
testcases/kernel/numa/support_numa.c +19 -0
@@ -53,6 +53,7 @@ static void help(void)printf ("Input: Describe input arguments to this program\n" );printf (" argv[1] == \"alloc_1MB\" then allocate 1MB of memory\n" );printf (" argv[1] == \"alloc_1MB_shared\" then allocate 1MB of share memory\n" ); +printf (" argv[1] == \"alloc_2HPSZ_THP\" then allocate 2HUGE PAGE SIZE of THP memory\n" );printf (" argv[1] == \"alloc_1huge_page\" then allocate 1HUGE PAGE SIZE of memory\n" );printf (" argv[1] == \"pause\" then pause the program to catch sigint\n" );printf ("Exit: On failure - Exits with non-zero value\n" );
@@ -138,6 +139,24 @@ int main(int argc, char *argv[])munmap (buf, sb.st_size);close (fd);remove (TEST_SFILE ); + }else if (!strcmp (argv[1 ],"alloc_2HPSZ_THP" )) { +ssize_t size =2 *read_hugepagesize (); +if (size ==0 ) +exit (1 ); + + buf =mmap (NULL , size,PROT_READ |PROT_WRITE , +MAP_PRIVATE |MAP_ANONYMOUS , +-1 ,0 ); +if (buf ==MAP_FAILED ) { +perror ("mmap failed" ); +exit (1 ); + } + +memset (buf,'a' , size); + +raise (SIGSTOP ); + +munmap (buf, size); }else if (!strcmp (argv[1 ],"alloc_1huge_page" )) { hpsz =read_hugepagesize ();if (hpsz ==0 )
Signature · 1 line
2.9.3
PATCH v2 1/1 numa: Add new regression test for MPOL_PREFERRED poliy
Hi!
Pushed, thanks.
Signature · 2 lines
Cyril Hrubis [email protected]