[LTP] [PATCH v3 2/5] API/cgroup: Declare required controllers and version in test struct

Li Wang liwang@redhat.com
Tue Feb 8 08:16:29 CET 2022


Hi Richard,

Richard Palethorpe <rpalethorpe@suse.com> wrote:


--- a/include/tst_cgroup.h
> +++ b/include/tst_cgroup.h
> ...
>
>  /* A Control Group in LTP's aggregated hierarchy */
>  struct tst_cgroup_group;
>
> +/* Populated with a reference to this tests's CGroup */
> +extern const struct tst_cgroup_group *const tst_cgroup;
> +extern const struct tst_cgroup_group *const tst_cgroup_drain;
>


--- a/lib/tst_cgroup.c
> +++ b/lib/tst_cgroup.c
> @@ -18,7 +18,6 @@
>  #include "lapi/mount.h"
>  #include "lapi/mkdirat.h"
>  #include "tst_safe_file_at.h"
> -#include "tst_cgroup.h"
>
>  struct cgroup_root;
>
> @@ -138,6 +137,14 @@ struct tst_cgroup_group {
>         struct cgroup_dir *dirs[ROOTS_MAX + 1];
>  };
>
> +/* If controllers are required via the tst_test struct then this is
> + * populated with the test's CGroup.
> + */
> +static struct tst_cgroup_group test_group;
> +static struct tst_cgroup_group drain_group;
> +const struct tst_cgroup_group *const tst_cgroup = &test_group;
>

What about declaring as 'tst_cgroup_test' ? i.e.

    const struct tst_cgroup_group *const tst_cgroup_test = &test_group;

As it is a reference to test's CGroup and the test_dir is the same
layer with drain_dir, so this will be easier to understand the relationship
with drain_group.


+const struct tst_cgroup_group *const tst_cgroup_drain = &drain_group;


The rest part looks quite good.
Reviewed-by: Li Wang <liwang@redhat.com>


-- 
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20220208/1f9a69ae/attachment-0001.htm>


More information about the ltp mailing list