[LTP] [PATCH] hugemmap32: guarantee enough memory for gigantic hugepage

Cyril Hrubis chrubis@suse.cz
Wed May 10 15:18:11 CEST 2023


Hi!
> diff --git a/testcases/kernel/mem/hugetlb/hugemmap/hugemmap32.c b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap32.c
> index 34b322bfa..7ff23b236 100644
> --- a/testcases/kernel/mem/hugetlb/hugemmap/hugemmap32.c
> +++ b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap32.c
> @@ -60,6 +60,12 @@ static void setup(void)
>  		tst_brk(TCONF, "Gigantic hugepages not supported");
>  
>  	SAFE_CLOSEDIR(dir);
> +
> +	if (tst_available_mem() < (long long)hpage_size) {
> +		g_hpage_path[0] = '\0';
> +		tst_brk(TCONF, "No enough memory for gigantic hugepage reserving");
                                                                       ^
								       reservation
> +	}
> +
>  	SAFE_FILE_LINES_SCANF(g_hpage_path, "%d", &org_g_hpages);
>  }

Otherwise it looks good:

Reviewed-by: Cyril Hrubis <chrubis@suse.cz>

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list