[LTP] [PATCH v2] madvise09: Scale cgroup memory/swap limits dynamically with page size

Li Wang li.wang@linux.dev
Fri Jul 24 11:05:15 CEST 2026


Wei Gao via ltp wrote:

> +	mem_limit = 16 * PAGES * page_size;
> +	swap_limit = 2 * mem_limit;
> +

> +	if (swap_accounting_enabled && (tst_available_swap() < swap_limit / 1024)) {
> +		tst_brk(TCONF, "System needs at least %lldMB free swap to run this test",
> +			swap_limit / TST_MB);

I suspect this available swap size comparison is duplicated with
.min_swap_avail, and perhaps we can remove BASE_SWAP_LIMIT and
.min_swap_avail from the test directly.

>  static struct tst_test test = {
> @@ -291,6 +301,6 @@ static struct tst_test test = {
>  	.test_all = run,
>  	.needs_root = 1,
>  	.forks_child = 1,

> -	.min_swap_avail = SWAP_LIMIT / TST_MB,
> +	.min_swap_avail = BASE_SWAP_LIMIT / TST_MB,

-- 
Regards,
Li Wang


More information about the ltp mailing list