[LTP] [PATCH 2/8] Refactor mmap10 test

Cyril Hrubis chrubis@suse.cz
Mon Feb 24 17:46:08 CET 2025


Hi!
>  #ifdef HAVE_DECL_MADV_MERGEABLE
>  	if (opt_ksm) {
> -		if (madvise(x, SIZE + SIZE - ps, MADV_MERGEABLE) == -1)
> -			tst_brkm(TBROK | TERRNO, cleanup, "madvise");
> +		if (madvise(memory, SIZE + SIZE - page_sz, MADV_MERGEABLE) == -1)
> +			tst_brk(TBROK | TERRNO, "madvise error");

We do have MADV_MERGEABLE in lapi/mmap.h I suppose that we can get rid
of the ifdefs as the kernel functionality was included in 2.6.32 which
is way older than anything we support now.

> +static struct tst_test test = {
> +	.test_all = run,
> +	.setup = setup,
> +	.needs_root = 1,
> +	.forks_child = 1,
> +	.options = (struct tst_option[]) {
> +		{"a", &opt_anon, "Test anonymous pages"},
> +		{"s", &opt_ksm, "Add to KSM regions"},
> +		{}

Can we get rid of these options too?

I do not see a reason why this cannot implement four different testcases
and that are executed in a row.

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list