<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-size:small"><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, May 27, 2020 at 3:45 PM Jan Stancek <<a href="mailto:jstancek@redhat.com">jstancek@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">> diff --git a/testcases/kernel/mem/cpuset/cpuset01.c<br>
> b/testcases/kernel/mem/cpuset/cpuset01.c<br>
> index 853f7fe55..cecc4ba86 100644<br>
> --- a/testcases/kernel/mem/cpuset/cpuset01.c<br>
> +++ b/testcases/kernel/mem/cpuset/cpuset01.c<br>
> @@ -51,11 +51,11 @@ static void test_cpuset(void)<br>
>       unsigned long nmask[MAXNODES / BITS_PER_LONG] = { 0 };<br>
>       char mems[BUFSIZ], buf[BUFSIZ];<br>
>  <br>
> -     read_cpuset_files(CPATH, "cpus", buf);<br>
> -     write_cpuset_files(CPATH_NEW, "cpus", buf);<br>
> -     read_cpuset_files(CPATH, "mems", mems);<br>
> -     write_cpuset_files(CPATH_NEW, "mems", mems);<br>
> -     SAFE_FILE_PRINTF(CPATH_NEW "/tasks", "%d", getpid());<br>
> +     read_cpuset_files(PATH_TMP_CG1_CST, "cpus", buf);<br>
> +     write_cpuset_files(PATH_CG1_CST_LTP, "cpus", buf);<br>
> +     read_cpuset_files(PATH_TMP_CG1_CST, "mems", mems);<br>
> +     write_cpuset_files(PATH_CG1_CST_LTP, "mems", mems);<br>
<br>
This mixes generic api with cgroup1. It currently relies on implementation<br>
detail of tst_cgroup_mount(), which isn't visible just by looking at this test.<br></blockquote><div><br></div><div><div class="gmail_default" style="font-size:small">Yes, here just uses many path macros, which makes things easy since mem/lib achieved many functions for cpuset files, I don't want to break the struct so keep it similar as previous. Anyway, we can reconstruct that but that is not the intention of this patchset.</div><br></div><div class="gmail_default" style="font-size:small">Btw, the test has no chance to go there because in setup() the tst_cgroup_mount(TST_CGROUP_CPUSET)</div><div class="gmail_default" style="font-size:small">will get TCONF if the system uses cgroup-v2.</div><div class="gmail_default" style="font-size:small"></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
We should make it generic or make it clear that test is for cgroup1 only:<br></blockquote><div><br></div><div><div class="gmail_default" style="font-size:small">But sure, we can add this, it makes code clear to readers.</div></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
setup()<br>
  if (tst_cgroup_version() != TST_CGROUP_V1)<br>
    TCONF<br>
<br>
<br>
> diff --git a/testcases/kernel/mem/oom/oom03.c<br>
> b/testcases/kernel/mem/oom/oom03.c<br>
> index ce0b34c31..af3a565ce 100644<br>
> --- a/testcases/kernel/mem/oom/oom03.c<br>
> +++ b/testcases/kernel/mem/oom/oom03.c<br>
> @@ -36,27 +36,26 @@<br>
>  <br>
>  #ifdef HAVE_NUMA_V2<br>
>  <br>
> -static int memcg_mounted;<br>
> -<br>
>  static void verify_oom(void)<br>
>  {<br>
>  #ifdef TST_ABI32<br>
>       tst_brk(TCONF, "test is not designed for 32-bit system.");<br>
>  #endif<br>
>  <br>
> -     SAFE_FILE_PRINTF(MEMCG_PATH_NEW "/tasks", "%d", getpid());<br>
> -     SAFE_FILE_PRINTF(MEMCG_LIMIT, "%ld", TESTMEM);<br>
> +     tst_cgroup_mem_set_maxbytes(TESTMEM);<br>
>  <br>
>       testoom(0, 0, ENOMEM, 1);<br>
>  <br>
> -     if (access(MEMCG_SW_LIMIT, F_OK) == -1) {<br>
> +     if ((access(PATH_MEMORY_SW_LIMIT, F_OK) == -1) ||<br>
> +                     (access(PATH_MEMORY_SW_MAX, F_OK) == -1)) {<br>
<br>
This could be tst_cgroup_mem_swapacct_enabled(), without need for test<br>
to probe specific cgroup[12] files.<br></blockquote><div><br></div><div class="gmail_default" style="font-size:small">Sounds good. I will have a try.</div></div><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Regards,<br></div><div>Li Wang<br></div></div></div></div>