diff options
-rw-r--r-- | kernel/cgroup.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/kernel/cgroup.c b/kernel/cgroup.c index b9f736c3b36d..398ffbbee32f 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c | |||
@@ -4555,12 +4555,27 @@ static void cgroup_css_killed(struct cgroup *cgrp) | |||
4555 | schedule_work(&cgrp->destroy_work); | 4555 | schedule_work(&cgrp->destroy_work); |
4556 | } | 4556 | } |
4557 | 4557 | ||
4558 | static void css_ref_killed_fn(struct percpu_ref *ref) | 4558 | /* |
4559 | * This is called when the refcnt of a css is confirmed to be killed. | ||
4560 | * css_tryget() is now guaranteed to fail. | ||
4561 | */ | ||
4562 | static void css_killed_work_fn(struct work_struct *work) | ||
4563 | { | ||
4564 | struct cgroup_subsys_state *css = | ||
4565 | container_of(work, struct cgroup_subsys_state, destroy_work); | ||
4566 | struct cgroup *cgrp = css->cgroup; | ||
4567 | |||
4568 | cgroup_css_killed(cgrp); | ||
4569 | } | ||
4570 | |||
4571 | /* css kill confirmation processing requires process context, bounce */ | ||
4572 | static void css_killed_ref_fn(struct percpu_ref *ref) | ||
4559 | { | 4573 | { |
4560 | struct cgroup_subsys_state *css = | 4574 | struct cgroup_subsys_state *css = |
4561 | container_of(ref, struct cgroup_subsys_state, refcnt); | 4575 | container_of(ref, struct cgroup_subsys_state, refcnt); |
4562 | 4576 | ||
4563 | cgroup_css_killed(css->cgroup); | 4577 | INIT_WORK(&css->destroy_work, css_killed_work_fn); |
4578 | schedule_work(&css->destroy_work); | ||
4564 | } | 4579 | } |
4565 | 4580 | ||
4566 | /** | 4581 | /** |
@@ -4634,7 +4649,7 @@ static int cgroup_destroy_locked(struct cgroup *cgrp) | |||
4634 | percpu_ref_get(&css->refcnt); | 4649 | percpu_ref_get(&css->refcnt); |
4635 | 4650 | ||
4636 | atomic_inc(&cgrp->css_kill_cnt); | 4651 | atomic_inc(&cgrp->css_kill_cnt); |
4637 | percpu_ref_kill_and_confirm(&css->refcnt, css_ref_killed_fn); | 4652 | percpu_ref_kill_and_confirm(&css->refcnt, css_killed_ref_fn); |
4638 | } | 4653 | } |
4639 | cgroup_css_killed(cgrp); | 4654 | cgroup_css_killed(cgrp); |
4640 | 4655 | ||