[LTP] [PATCH 05/16] API/cgroup: Add more controllers to tst_cgroup

Richard Palethorpe rpalethorpe@suse.de
Mon Jan 24 12:36:24 CET 2022


Hello Luke,

Luke Nowakowski-Krijger <luke.nowakowskikrijger@canonical.com> writes:

> Add more controllers so that they can be mounted and used using the
> cgroup C api.
>
> Most of the controllers used in controllers tests are added and a
> reasonable working set of the controller control files that I came
> across are added as well.
>
> Signed-off-by: Luke Nowakowski-Krijger <luke.nowakowskikrijger@canonical.com>
> ---
>  lib/tst_cgroup.c | 153 ++++++++++++++++++++++++++++++++++++++++++++++-
>  1 file changed, 152 insertions(+), 1 deletion(-)
>
> diff --git a/lib/tst_cgroup.c b/lib/tst_cgroup.c
> index df541d26a..3d56a3364 100644
> --- a/lib/tst_cgroup.c
> +++ b/lib/tst_cgroup.c
> @@ -84,8 +84,20 @@ enum cgroup_ctrl_indx {
>  	CTRL_MEMORY = 1,
>  	CTRL_CPU,
>  	CTRL_CPUSET,
> +	CTRL_IO,
> +	CTRL_PIDS,
> +	CTRL_RDMA,
> +	CTRL_HUGETLB,
> +	CTRL_CPUACCT,
> +	CTRL_DEVICES,
> +	CTRL_FREEZER,
> +	CTRL_NETCLS,
> +	CTRL_NETPRIO,
> +	CTRL_BLKIO,
> +	CTRL_MISC,
> +	CTRL_PERFEVENT
>  };
> -#define CTRLS_MAX CTRL_CPUSET
> +#define CTRLS_MAX CTRL_PERFEVENT
>  
>  /* At most we can have one cgroup V1 tree for each controller and one
>   * (empty) v2 tree.
> @@ -181,6 +193,109 @@ static const struct cgroup_file cpuset_ctrl_files[] = {
>  	{ }
>  };
>  
> +static const struct cgroup_file io_ctrl_files[] = {
> +	{ "io.state", NULL, CTRL_IO },
> +	{ "io.cost.qos", NULL, CTRL_IO },
> +	{ "io.cost.model", NULL, CTRL_IO },
> +	{ "io.weight", NULL, CTRL_IO },
> +	{ "io.max", NULL, CTRL_IO },
> +	{ "io.pressure", NULL, CTRL_IO },
> +	{ }
> +};
> +
> +static const struct cgroup_file pids_ctrl_files[] = {
> +	{ "pids.max", "pids.max", CTRL_PIDS },
> +	{ "pids.current", "pids.current", CTRL_PIDS },
> +	{ }
> +};
> +
> +static const struct cgroup_file rdma_ctrl_files[] = {
> +	{ "rdma.max", "rdma.max", CTRL_RDMA },
> +	{ "rdma.current", "rdma.current", CTRL_RDMA },
> +	{ }
> +};

Please don't add stuff we don't have an immediate requirement for!

We don't have any tests for RDMA yet. I can't even find the "rdma|RDMA"
in the LTP codebase. We may never test most of these controllers, it's
just dead code that will have to be rewritten if/when we have to
implement a more complex V1/V2 compatability layer. Also, as with blkio
and io, you may be adding the same controllers twice under V1 and V2
names.

Just add the exact things we need for existing tests.

-- 
Thank you,
Richard.


More information about the ltp mailing list