Re: [LTP] [PATCH v7 1/2] cpuset02: Convert the test6 from cpuset_memory_testset.sh to C code

Li Wang via ltp
2025-03-26T08:39:42Z

Petr Vorel <pvorel@suse.cz> wrote:

> > +static struct tst_test test = {
> > + .needs_root = 1,
> > + .runs_script = 1,
> > + .mntpoint = MNTPOINT,
> > + .needs_hugetlbfs = 1,
> > + .setup = setup,
> > + .forks_child = 1,
> > + .cleanup = cleanup,
> > + .test_all = run_test,
>

> > + .hugepages = {3, TST_NEEDS},
>

This line is equal to `echo 3 > /proc/sys/vm/nr_hugepages` and check the 3
is there.

> > + .needs_checkpoints = 1,
> > + .needs_cgroup_ver = TST_CG_V1,
> > + .needs_cgroup_ctrls = (const char *const []){ "cpuset", NULL },
> > + .save_restore = (const struct tst_path_val[]) {
> > + {"/proc/sys/vm/nr_hugepages", NULL, TST_SR_TBROK},
>

If we set .hugepages then this line is redundant, because ltp-lib
already saved/restored that nr_hugepages for test.

See line#68 in /lib/tst_hugepage.c

--
Regards,
Li Wang