projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
02214bf
)
cgroup: Simplify cgroup_ancestor
author
Andrey Ignatov
<
[email protected]
>
Sat, 22 Sep 2018 00:03:27 +0000
(17:03 -0700)
committer
Tejun Heo
<
[email protected]
>
Mon, 24 Sep 2018 17:38:16 +0000
(10:38 -0700)
Simplify cgroup_ancestor function. This is follow-up for
commit
7723628101aa
("bpf: Introduce bpf_skb_ancestor_cgroup_id helper")
Suggested-by: Tejun Heo <
[email protected]
>
Signed-off-by: Andrey Ignatov <
[email protected]
>
Signed-off-by: Tejun Heo <
[email protected]
>
include/linux/cgroup.h
patch
|
blob
|
history
diff --git
a/include/linux/cgroup.h
b/include/linux/cgroup.h
index 32c553556bbdc1c0d6f2db6c1fb86ddee6713367..e03a92430383d7df4de0cc894574a214f3b881c6 100644
(file)
--- a/
include/linux/cgroup.h
+++ b/
include/linux/cgroup.h
@@
-567,20
+567,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;
}
/**