# Re: \[PATCH 1/5\] cgroup: record ancestor IDs and reimplement cgroup\_is\_descendant() using it

- From: Jan Engelhardt \<hidden\>
- Date: 2015-11-17 22:54:58 
- List: netdev
- Page: https://ratatoskr.run/netdev/2015/11/4622795
- Thread: https://ratatoskr.run/netdev/2015/11/4622696/t.md

```text

On Tuesday 2015-11-17 20:40, Tejun Heo wrote:
>+static inline bool cgroup_is_descendant(struct cgroup *cgrp,
>+					struct cgroup *ancestor)

(const struct group *cgrp, const struct group *ancestor)

>+{
>+	if (cgrp->root != ancestor->root || cgrp->level < ancestor->level)
>+		return false;
>+	return cgrp->ancestor_ids[ancestor->level] == ancestor->id;
>+}
```
