[LTP] [PATCH] controllers/cpuset: add cpuset files check for different OS

Petr Vorel pvorel@suse.cz
Wed Nov 10 12:15:25 CET 2021


Hi Richie, Li,

> Hello,

> Petr Vorel <pvorel@suse.cz> writes:

> > Hi Li,

> >> While mounting cpuset cgroup, the subsystem directory entries
> >> differ in different OS release.
> >> eg, cpuset.cpus file on Ubuntu and cpus on some other release.
> > Which ones, please? I'm not aware of anyone.

> Unfortunately it is possible. cpuset can be mounted without a prefix
> using a legacy compatability option. OTOH this is really ancient.

Thanks for info.


> >> So we add cpuset files checker to make sure the test work well
> >> on all OS release.

> > ...
> >> +++ b/testcases/kernel/controllers/cpuset/cpuset_funcs.sh
> > ...
> >> +cpus_file=
> >> +cpu_exclusive_file=
> >> +mems_file=
> >> +memory_pressure_file=
> >> +memory_pressure_enabled_file=
> >> +mem_exclusive_file=
> >> +mem_hardwall_file=
> >> +memory_migrate_file=
> >> +memory_spread_page_file=
> >> +memory_spread_slab_file=
> >> +sched_load_balance_file=
> >> +sched_relax_domain_level_file=
> > Maybe move the ones in $CPUSET/cpuset.cpus clause here as the default ones
> > and move those from else clause into setup.

> > ...
> >> +# check cpuset cgroup files for different OS
> >> +cpuset_files_check()
> >> +{
> >> +	setup
> > I guess this should be vice versa, i.e. cpuset_files_check() be part of setup()
> > And then not needed to be added into all functions using cpuset_funcs.sh

> Probably we could just do

> if [ -f $CPUSET/cpuset.cpus" ]; then
>    cpuset_prefix="cpuset."
> else
>    cpuset_prefix=
> fi

> then replace cpuset. with $cpuset_prefix

+1, just maybe tiny improvement to remove else part:

cpuset_prefix=
if [ -f $CPUSET/cpuset.cpus" ]; then
	cpuset_prefix="cpuset."
fi

Kind regards,
Petr


More information about the ltp mailing list