<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-size:small"><br></div></div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Richard Palethorpe via ltp <<a href="mailto:ltp@lists.linux.it" target="_blank">ltp@lists.linux.it</a>> wrote:<br></div><div dir="ltr" class="gmail_attr"><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Rewrite of existing test and new test for the CGroups API.<br>
<span class="gmail_default" style="font-size:small">...</span><br>
--- a/lib/newlib_tests/test21.c<br>
+++ b/lib/newlib_tests/test21.c<br>
@@ -11,8 +11,6 @@<br>
 #include "tst_test.h"<br>
 #include "tst_cgroup.h"<br>
<br>
-#define PATH_CGROUP1 "/mnt/liwang1"<br>
-#define PATH_CGROUP2 "/mnt/liwang2"<br>
 #define MEMSIZE 1024 * 1024<br>
<br>
 static void do_test(void)<br>
@@ -21,19 +19,16 @@ static void do_test(void)<br>
<br>
        switch (pid) {<br>
        case 0:<br>
-               tst_cgroup_move_current(PATH_CGROUP1);<br>
-               tst_cgroup_mem_set_maxbytes(PATH_CGROUP1, MEMSIZE);<br>
-               tst_cgroup_mem_set_maxswap(PATH_CGROUP1, MEMSIZE);<br>
-<br>
-               tst_cgroup_move_current(PATH_CGROUP2);<br>
-<br>
+               tst_cgroup_move_current(TST_<span class="gmail_default" style="font-size:small"></span>CGROUP_MEMORY);<br>
+               tst_cgroup_mem_set_maxbytes(MEMSIZE);<br>
+               tst_cgroup_mem_set_maxswap(MEMSIZE);<br></blockquote><div><br></div><div><div class="gmail_default" style="font-size:small">We'd better set a different value(maybe MEMSIZE/2) for <span class="gmail_default">the child's</span></div><div class="gmail_default" style="font-size:small">CGROUP_MEMORY because test21 is designed to verify there is</div><div class="gmail_default" style="font-size:small">no race condition when multithread using the same controller. In</div><div class="gmail_default" style="font-size:small">other words, we need to avoid that iteration become a NOP.</div><br></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">
        break;<br>
        default:<br>
-               tst_cgroup_move_current(PATH_TMP_CG_CST);<br>
+               tst_cgroup_move_current(TST_CGROUP_CPUSET);<br>
<br>
-               tst_cgroup_move_current(PATH_TMP_CG_MEM);<br>
-               tst_cgroup_mem_set_maxbytes(PATH_TMP_CG_MEM, MEMSIZE);<br>
-               tst_cgroup_mem_set_maxswap(PATH_TMP_CG_MEM, MEMSIZE);<br>
+               tst_cgroup_move_current(TST_CGROUP_MEMORY);<br>
+               tst_cgroup_mem_set_maxbytes(MEMSIZE);<br>
+               tst_cgroup_mem_set_maxswap(MEMSIZE);<br>
        break;<br>
        }<br>
<br>
@@ -42,20 +37,11 @@ static void do_test(void)<br>
<br>
 static void setup(void)<br>
 {<br>
-       tst_cgroup_mount(TST_CGROUP_MEMCG, PATH_TMP_CG_MEM);<br>
-       tst_cgroup_mount(TST_CGROUP_MEMCG, PATH_CGROUP1);<br>
-<br>
-       tst_cgroup_mount(TST_CGROUP_CPUSET, PATH_TMP_CG_CST);<br>
-       tst_cgroup_mount(TST_CGROUP_CPUSET, PATH_CGROUP2);<br>
+       tst_cgroup_require(TST_CGROUP_MEMORY, NULL);<br></blockquote><div><br></div><div><div class="gmail_default" style="font-size:small">The test requires _CPUSET too:</div></div><div><div class="gmail_default" style="font-size:small">    tst_cgroup_require(TST_CGROUP_CPUSET, NULL);</div></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
 }<br>
<br>
 static void cleanup(void)<br>
 {<br>
-       tst_cgroup_umount(PATH_TMP_CG_MEM);<br>
-       tst_cgroup_umount(PATH_CGROUP1);<br>
-<br>
-       tst_cgroup_umount(PATH_TMP_CG_CST);<br>
-       tst_cgroup_umount(PATH_CGROUP2);<br>
 }<br></blockquote><div> </div></div>-- <br><div dir="ltr"><div dir="ltr"><div>Regards,<br></div><div>Li Wang<br></div></div></div></div>