Skip to content

Commit

Permalink
cgroup: add css_set->dfl_cgrp
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
htejun committed Apr 23, 2014
1 parent bd53d61 commit 6803c00
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions include/linux/cgroup.h
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,9 @@ struct css_set {
*/
struct list_head cgrp_links;

/* the default cgroup associated with this css_set */
struct cgroup *dfl_cgrp;

/*
* Set of subsystem states, one for each subsystem. This array is
* immutable after creation apart from the init_css_set during
Expand Down
4 changes: 4 additions & 0 deletions kernel/cgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,10 @@ static void link_css_set(struct list_head *tmp_links, struct css_set *cset,
struct cgrp_cset_link *link;

BUG_ON(list_empty(tmp_links));

if (cgroup_on_dfl(cgrp))
cset->dfl_cgrp = cgrp;

link = list_first_entry(tmp_links, struct cgrp_cset_link, cset_link);
link->cset = cset;
link->cgrp = cgrp;
Expand Down

0 comments on commit 6803c00

Please sign in to comment.