Skip to contentSkip to conversation

cgroup: short-circuit cset_cgroup_from_root() on the default hierarchy

PATCH New Tejun Heo 1 participant 1 message Aug 2, 2017 cgroup

lore
Share & tools
lore

Tejun Heo

author
#0 lore raw

PATCH 1/1 cgroup: short-circuit cset_cgroup_from_root() on the default hierarchy

Each css_set directly points to the default cgroup it belongs to, so there's no reason to walk the cgrp_links list on the default hierarchy.

---
Minor optimization. Applying to cgroup/for-4.14.

Thanks.

 kernel/cgroup/cgroup.c |    2 ++
 1 file changed, 2 insertions(+)
kernel/cgroup/cgroup.c +2 -0
@@ -1311,6 +1311,8 @@ static struct cgroup *cset_cgroup_from_r
 
 	if (cset == &init_css_set) {
 		res = &root->cgrp;
+	} else if (root == &cgrp_dfl_root) {
+		res = cset->dfl_cgrp;
 	} else {
 		struct cgrp_cset_link *link;