Skip to content

Commit e69e481

Browse files
committed
stress-hugepage: use per-arch allocation sizes for best match for THP
If hugepage support mmap's are not available, use best per-arch sizes for mmapping if transparent huge page support is enabled. Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
1 parent 55dffb9 commit e69e481

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

stress-hugepage.c

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
*
1818
*/
1919
#include "stress-ng.h"
20+
#include "core-arch.h"
2021
#include "core-builtin.h"
2122
#include "core-mmap.h"
2223
#include "core-pthread.h"
@@ -179,8 +180,24 @@ static const stress_hugepage_size_t hugepage_sizes[] = {
179180
{ MAP_HUGETLB, 2 * GB },
180181
{ MAP_HUGETLB, 16 * GB },
181182

182-
/* vanilla non-huge page mmap options */
183+
/*
184+
* vanilla non-huge page mmap options,
185+
* try to select sizes that may end up
186+
* being huge page sized for transparent
187+
* huge page allocation
188+
*/
189+
#if (defined(STRESS_ARCH_ARM) && defined(__aarch64__)) || \
190+
defined(STRESS_ARCH_X86_64)
183191
{ 0, 2 * MB },
192+
#elif defined(STRESS_ARCH_X86_32)
193+
{ 0, 4 * MB },
194+
/* or PAE mode */
195+
{ 0, 2 * MB },
196+
#elif defined(STRESS_ARCH_PPC64)
197+
{ 0, 16 * MB },
198+
#else
199+
{ 0, 2 * MB },
200+
#endif
184201
{ 0, 8 * MB },
185202
{ 0, 16 * MB },
186203
{ 0, 32 * MB },

0 commit comments

Comments
 (0)