Commit 6803c006282768ec850760766a6e4eb1a6ff87df
1 parent
bd53d617b3
Exists in
ti-lsk-linux-4.1.y
and in
10 other branches
cgroup: add css_set->dfl_cgrp
To implement the unified hierarchy behavior, we'll need to be able to determine the associated cgroup on the default hierarchy from css_set. Let's add css_set->dfl_cgrp so that it can be accessed conveniently and efficiently. Signed-off-by: Tejun Heo <tj@kernel.org> Acked-by: Li Zefan <lizefan@huawei.com>
Showing 2 changed files with 7 additions and 0 deletions Side-by-side Diff
include/linux/cgroup.h
... | ... | @@ -354,6 +354,9 @@ |
354 | 354 | */ |
355 | 355 | struct list_head cgrp_links; |
356 | 356 | |
357 | + /* the default cgroup associated with this css_set */ | |
358 | + struct cgroup *dfl_cgrp; | |
359 | + | |
357 | 360 | /* |
358 | 361 | * Set of subsystem states, one for each subsystem. This array is |
359 | 362 | * immutable after creation apart from the init_css_set during |
kernel/cgroup.c
... | ... | @@ -651,6 +651,10 @@ |
651 | 651 | struct cgrp_cset_link *link; |
652 | 652 | |
653 | 653 | BUG_ON(list_empty(tmp_links)); |
654 | + | |
655 | + if (cgroup_on_dfl(cgrp)) | |
656 | + cset->dfl_cgrp = cgrp; | |
657 | + | |
654 | 658 | link = list_first_entry(tmp_links, struct cgrp_cset_link, cset_link); |
655 | 659 | link->cset = cset; |
656 | 660 | link->cgrp = cgrp; |