aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/include/linux/cgroup.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-10-25 17:15:46 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2018-10-25 17:15:46 -0700
commit83c4087ce468601501ecde4d0ec5b2abd5f57c31 (patch)
tree238d60de7b4f5b4b70fe851c76f04e5a5f5efaa4 /include/linux/cgroup.h
parentMerge tag 'printk-for-4.20' of git://git.kernel.org/pub/scm/linux/kernel/git/pmladek/printk (diff)
parentcgroup, netclassid: add a preemption point to write_classid (diff)
downloadwireguard-linux-83c4087ce468601501ecde4d0ec5b2abd5f57c31.tar.xz
wireguard-linux-83c4087ce468601501ecde4d0ec5b2abd5f57c31.zip
Merge branch 'for-4.20' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup
Pull cgroup updates from Tejun Heo: "All trivial changes - simplification, typo fix and adding cond_resched() in a netclassid update loop" * 'for-4.20' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup: cgroup, netclassid: add a preemption point to write_classid rdmacg: fix a typo in rdmacg documentation cgroup: Simplify cgroup_ancestor
Diffstat (limited to 'include/linux/cgroup.h')
-rw-r--r--include/linux/cgroup.h15
1 files changed, 3 insertions, 12 deletions
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index b8bcbdeb2eac..b622d6608605 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -569,20 +569,11 @@ static inline bool cgroup_is_descendant(struct cgroup *cgrp,
static inline struct cgroup *cgroup_ancestor(struct cgroup *cgrp,
int ancestor_level)
{
- struct cgroup *ptr;
-
if (cgrp->level < ancestor_level)
return NULL;
-
- for (ptr = cgrp;
- ptr && ptr->level > ancestor_level;
- ptr = cgroup_parent(ptr))
- ;
-
- if (ptr && ptr->level == ancestor_level)
- return ptr;
-
- return NULL;
+ while (cgrp && cgrp->level > ancestor_level)
+ cgrp = cgroup_parent(cgrp);
+ return cgrp;
}
/**