hugemmap05: check if the reserving hpages as expected
PATCH 1/1 hugemmap05: check if the reserving hpages as expected
To get rid of TBROK on small box:
hugemmap05.c:88: BROK: mmap((nil),201326592,3,1,6,0) failed: ENOMEM (12)
And, reduce the reserved testing huge pages to 2, it also works well.
---
Notes:
I didn't remove the variable 'size' and 'length' because that could be used to reset testing hpages via parameter '-a xxx'
# ./hugemmap05 -a 128
.../kernel/mem/hugetlb/hugemmap/hugemmap05.c | 20 +++++++------------ 1 file changed, 7 insertions(+), 13 deletions(-)
testcases/kernel/mem/hugetlb/hugemmap/hugemmap05.c +7 -13
@@ -57,9 +57,9 @@ static char path_sys_sz_huge[BUFSIZ];static unsigned long long shmmax;static char *path, *pathover;static int key =-1 , shmid =-1 , fd =-1 ; -static int mounted, restore_shmmax, restore_nr_hgpgs, restore_overcomm_hgpgs; -static long hugepagesize, nr_hugepages, nr_overcommit_hugepages; -static long size =128 , length =384 ; +static int mounted, restore_shmmax, restore_overcomm_hgpgs; +static long hugepagesize, nr_overcommit_hugepages; +static long size =2 , length =6 ;char *opt_sysfs;char *opt_alloc;
@@ -176,11 +176,6 @@ static void cleanup(void)if (mounted)tst_umount (MOUNT_DIR ); -if (restore_nr_hgpgs) { -tst_res (TINFO ,"restore nr_hugepages to %ld." , nr_hugepages); -SAFE_FILE_PRINTF (path,"%ld" , nr_hugepages); - } -if (restore_shmmax)SAFE_FILE_PRINTF (PATH_SHMMAX ,"%llu" , shmmax);
@@ -193,7 +188,9 @@ static void cleanup(void)static void setup (void ) { -check_hugepage (); +if (tst_hugepages !=2 ) +tst_brk (TCONF ,"Not enough hugepages for testing!" ); + hugepagesize =SAFE_READ_MEMINFO ("Hugepagesize:" ) *1024 ;init_sys_sz_paths ();
@@ -219,12 +216,8 @@ static void setup(void) } } -SAFE_FILE_SCANF (path,"%ld" , &nr_hugepages); -tst_res (TINFO ,"original nr_hugepages is %ld" , nr_hugepages); -/* Reset. */ SAFE_FILE_PRINTF (path,"%ld" , size); - restore_nr_hgpgs =1 ;if (access (pathover,F_OK )) { tst_brk(TCONF, "file %s does not exist in the system",
@@ -309,4 +302,5 @@ static struct tst_test test = { .setup = setup, .cleanup = cleanup, .test_all = test_overcommit, + .request_hugepages = 2, };
Signature · 1 line
2.21.1
PATCH 1/1 hugemmap05: check if the reserving hpages as expected
Hi Li,
Quoted 4 lines
To get rid of TBROK on small box:
hugemmap05.c:88: BROK: mmap((nil),201326592,3,1,6,0) failed: ENOMEM (12)And, reduce the reserved testing huge pages to 2, it also works well.
Nice speedup :)
Maybe add some constant for size (2), as it's used on 3 places?
Kind regards,
Petr
PATCH 1/1 hugemmap05: check if the reserving hpages as expected
Quoted 10 lines · Petr Vorel
Hi Li,
Quoted 2 lines
To get rid of TBROK on small box:
hugemmap05.c:88: BROK: mmap((nil),201326592,3,1,6,0) failed: ENOMEM(12)
Quoted 1 line
And, reduce the reserved testing huge pages to 2, it also works well.
Reviewed-by Petr Vorel <[email protected]>
Thanks for your review.
Quoted 4 lines
Nice speedup :)
Maybe add some constant for size (2), as it's used on 3 places?
Good suggestion, I added a 'NR_HPAGES' definition and pushed.
Signature · 5 lines
Regards, Li Wang -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.linux.it/pipermail/ltp/attachments/20200526/65fd1a89/attachment.htm>