[LTP] [PATCH 1/2] madvise06: Fix segfault

Petr Vorel pvorel@suse.cz
Fri Mar 11 15:46:54 CET 2022


Hi Cyril,

...
> >  	if (SAFE_CG_HAS(tst_cg, "memory.swappiness")) {
> > -		SAFE_CG_PRINT(tst_cg, "memory.swappiness", "60");
> > +		SAFE_CG_PRINT(tst_cg, "memory.swappiness", SWAPPINESS);
> >  	} else {
> >  		check_path("/proc/sys/vm/swappiness");
> > -		SAFE_FILE_PRINTF("/proc/sys/vm/swappiness", "%d", 60);
> >  	}

> I'm not sure if we want to set the "/proc/sys/vm/swappiness"
> unconditinally in the .save_restore as previously we set it only if the
> cgroup was missing the swappines knob.

> So maybe we should go for a minimal fix here, just change the
> save_restore to match the new format and don't set the value there.
Make sense.

> >  	SAFE_CG_PRINTF(tst_cg, "cgroup.procs", "%d", getpid());
> > @@ -229,8 +229,8 @@ static struct tst_test test = {
> >  	.min_kver = "3.10.0",
> >  	.needs_tmpdir = 1,
> >  	.needs_root = 1,
> > -	.save_restore = (const char * const[]) {
> > -		"?/proc/sys/vm/swappiness",
> > +	.save_restore = (const struct tst_path_val const[]) {
> > +		{"?/proc/sys/vm/swappiness", SWAPPINESS},
> >  		NULL

> This has to be terminated by {} now.
Ah, thx!

Anyway, merged only minimal change with your Reviewed-by: tag.

Thanks!

Kind regards,
Petr


More information about the ltp mailing list