<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-size:small"> Hi Richard,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Thanks for your work, the whole design looks good.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Minor suggestions as below:</div><div class="gmail_default" style="font-size:small"> <br></div></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+static const char *ltp_cgroup_dir = "ltp";<br>
+static const char *ltp_cgroup_drain_dir = "drain";<br>
+static char test_cgroup_dir[PATH_MAX/4];<br>
+static const char *ltp_mount_prefix = "/tmp/cgroup_";<br>
+static const char *ltp_v2_mount = "unified";<br>
+<br>
+#define first_root \<br>
+ (roots[0].ver ? roots : roots + 1)<br>
+#define for_each_root(r) \<br>
+ for ((r) = first_root; (r)->ver; (r)++)<br>
+#define for_each_v1_root(r) \<br>
+ for ((r) = roots + 1; (r)->ver; (r)++)<br></blockquote><div><br></div><div><div class="gmail_default" style="font-size:small">If you go through the whole files you will find, there are some places use</div><div class="gmail_default" style="font-size:small">'r' to represent the root but other uses 't', even in functions that include ‘t‘</div><div class="gmail_default" style="font-size:small">to represent a tree. </div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">That probably a minor issue to make people get lost:).</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">So I'd suggest a unified abbreviation in all:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">r --> root</div><div class="gmail_default" style="font-size:small">t --> tree</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">if a function has root and tree, plz avoid using abbreviations, just use itself.</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">
+#define for_each_css(css) \<br>
+ for ((css) = items + 1; (css)->name; (css)++)<br>
+<br>
+/* Controller items may only be in a single tree. So when (ss) > 0<br>
+ * we only loop once.<br>
+ */<br>
+#define for_each_tree(cg, css, t) \<br>
+ for ((t) = (css) ? (cg)->trees_by_css + (css) : (cg)->trees; \<br>
+ *(t); \<br>
+ (t) = (css) ? (cg)->trees + TST_CGROUP_MAX_TREES : (t) + 1)<br>
+<br>
+static int has_css(uint32_t css_field, enum tst_cgroup_css type)<br>
+{<br>
+ return !!(css_field & (1 << type));<br>
}<br>
<br></blockquote><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">
+struct tst_cgroup *tst_cgroup_mk(const struct tst_cgroup *parent,<br>
+ const char *name)<br>
{<br></blockquote><div><br></div><div><div class="gmail_default" style="font-size:small">Since we have already got the parent tst_cgroup, it means we know which</div><div class="gmail_default" style="font-size:small">controllers/type has been mounted. </div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Can we add the required controllers (e.g. "+memory") to subtree_control</div><div class="gmail_default" style="font-size:small">automatically at here, rather than doing it manually before creating children?</div><div class="gmail_default" style="font-size:small">(then we can remove the line#27~30 in tst_cgroup02.c)</div></div><div><br></div></div><div><br></div>-- <br><div dir="ltr"><div dir="ltr"><div>Regards,<br></div><div>Li Wang<br></div></div></div></div>