Commit 1db1e31b authored by Tejun Heo's avatar Tejun Heo

Merge branch 'cgroup-rmdir-updates' into cgroup/for-3.8

Pull rmdir updates into for-3.8 so that further callback updates can
be put on top.  This pull created a trivial conflict between the
following two commits.

  8c7f6edb ("cgroup: mark subsystems with broken hierarchy support and whine if cgroups are nested for them")
  ed957793 ("cgroup: kill cgroup_subsys->__DEPRECATED_clear_css_refs")

The former added a field to cgroup_subsys and the latter removed one
from it.  They happen to be colocated causing the conflict.  Keeping
what's added and removing what's removed resolves the conflict.
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
parents 5d8f72b5 bcf6de1b
...@@ -600,7 +600,7 @@ struct cftype blkcg_files[] = { ...@@ -600,7 +600,7 @@ struct cftype blkcg_files[] = {
* *
* This is the blkcg counterpart of ioc_release_fn(). * This is the blkcg counterpart of ioc_release_fn().
*/ */
static int blkcg_pre_destroy(struct cgroup *cgroup) static void blkcg_pre_destroy(struct cgroup *cgroup)
{ {
struct blkcg *blkcg = cgroup_to_blkcg(cgroup); struct blkcg *blkcg = cgroup_to_blkcg(cgroup);
...@@ -622,7 +622,6 @@ static int blkcg_pre_destroy(struct cgroup *cgroup) ...@@ -622,7 +622,6 @@ static int blkcg_pre_destroy(struct cgroup *cgroup)
} }
spin_unlock_irq(&blkcg->lock); spin_unlock_irq(&blkcg->lock);
return 0;
} }
static void blkcg_destroy(struct cgroup *cgroup) static void blkcg_destroy(struct cgroup *cgroup)
......
...@@ -81,8 +81,6 @@ struct cgroup_subsys_state { ...@@ -81,8 +81,6 @@ struct cgroup_subsys_state {
/* bits in struct cgroup_subsys_state flags field */ /* bits in struct cgroup_subsys_state flags field */
enum { enum {
CSS_ROOT, /* This CSS is the root of the subsystem */ CSS_ROOT, /* This CSS is the root of the subsystem */
CSS_REMOVED, /* This CSS is dead */
CSS_CLEAR_CSS_REFS, /* @ss->__DEPRECATED_clear_css_refs */
}; };
/* Caller must verify that the css is not for root cgroup */ /* Caller must verify that the css is not for root cgroup */
...@@ -105,11 +103,6 @@ static inline void css_get(struct cgroup_subsys_state *css) ...@@ -105,11 +103,6 @@ static inline void css_get(struct cgroup_subsys_state *css)
__css_get(css, 1); __css_get(css, 1);
} }
static inline bool css_is_removed(struct cgroup_subsys_state *css)
{
return test_bit(CSS_REMOVED, &css->flags);
}
/* /*
* Call css_tryget() to take a reference on a css if your existing * Call css_tryget() to take a reference on a css if your existing
* (known-valid) reference isn't already ref-counted. Returns false if * (known-valid) reference isn't already ref-counted. Returns false if
...@@ -147,10 +140,6 @@ enum { ...@@ -147,10 +140,6 @@ enum {
CGRP_RELEASABLE, CGRP_RELEASABLE,
/* Control Group requires release notifications to userspace */ /* Control Group requires release notifications to userspace */
CGRP_NOTIFY_ON_RELEASE, CGRP_NOTIFY_ON_RELEASE,
/*
* A thread in rmdir() is wating for this cgroup.
*/
CGRP_WAIT_ON_RMDIR,
/* /*
* Clone cgroup values when creating a new child cgroup * Clone cgroup values when creating a new child cgroup
*/ */
...@@ -420,23 +409,6 @@ int cgroup_task_count(const struct cgroup *cgrp); ...@@ -420,23 +409,6 @@ int cgroup_task_count(const struct cgroup *cgrp);
/* Return true if cgrp is a descendant of the task's cgroup */ /* Return true if cgrp is a descendant of the task's cgroup */
int cgroup_is_descendant(const struct cgroup *cgrp, struct task_struct *task); int cgroup_is_descendant(const struct cgroup *cgrp, struct task_struct *task);
/*
* When the subsys has to access css and may add permanent refcnt to css,
* it should take care of racy conditions with rmdir(). Following set of
* functions, is for stop/restart rmdir if necessary.
* Because these will call css_get/put, "css" should be alive css.
*
* cgroup_exclude_rmdir();
* ...do some jobs which may access arbitrary empty cgroup
* cgroup_release_and_wakeup_rmdir();
*
* When someone removes a cgroup while cgroup_exclude_rmdir() holds it,
* it sleeps and cgroup_release_and_wakeup_rmdir() will wake him up.
*/
void cgroup_exclude_rmdir(struct cgroup_subsys_state *css);
void cgroup_release_and_wakeup_rmdir(struct cgroup_subsys_state *css);
/* /*
* Control Group taskset, used to pass around set of tasks to cgroup_subsys * Control Group taskset, used to pass around set of tasks to cgroup_subsys
* methods. * methods.
...@@ -466,7 +438,7 @@ int cgroup_taskset_size(struct cgroup_taskset *tset); ...@@ -466,7 +438,7 @@ int cgroup_taskset_size(struct cgroup_taskset *tset);
struct cgroup_subsys { struct cgroup_subsys {
struct cgroup_subsys_state *(*create)(struct cgroup *cgrp); struct cgroup_subsys_state *(*create)(struct cgroup *cgrp);
int (*pre_destroy)(struct cgroup *cgrp); void (*pre_destroy)(struct cgroup *cgrp);
void (*destroy)(struct cgroup *cgrp); void (*destroy)(struct cgroup *cgrp);
int (*can_attach)(struct cgroup *cgrp, struct cgroup_taskset *tset); int (*can_attach)(struct cgroup *cgrp, struct cgroup_taskset *tset);
void (*cancel_attach)(struct cgroup *cgrp, struct cgroup_taskset *tset); void (*cancel_attach)(struct cgroup *cgrp, struct cgroup_taskset *tset);
...@@ -487,17 +459,6 @@ struct cgroup_subsys { ...@@ -487,17 +459,6 @@ struct cgroup_subsys {
*/ */
bool use_id; bool use_id;
/*
* If %true, cgroup removal will try to clear css refs by retrying
* ss->pre_destroy() until there's no css ref left. This behavior
* is strictly for backward compatibility and will be removed as
* soon as the current user (memcg) is updated.
*
* If %false, ss->pre_destroy() can't fail and cgroup removal won't
* wait for css refs to drop to zero before proceeding.
*/
bool __DEPRECATED_clear_css_refs;
/* /*
* If %false, this subsystem is properly hierarchical - * If %false, this subsystem is properly hierarchical -
* configuration, resource accounting and restriction on a parent * configuration, resource accounting and restriction on a parent
......
This diff is collapsed.
...@@ -155,18 +155,13 @@ static void hugetlb_cgroup_move_parent(int idx, struct cgroup *cgroup, ...@@ -155,18 +155,13 @@ static void hugetlb_cgroup_move_parent(int idx, struct cgroup *cgroup,
* Force the hugetlb cgroup to empty the hugetlb resources by moving them to * Force the hugetlb cgroup to empty the hugetlb resources by moving them to
* the parent cgroup. * the parent cgroup.
*/ */
static int hugetlb_cgroup_pre_destroy(struct cgroup *cgroup) static void hugetlb_cgroup_pre_destroy(struct cgroup *cgroup)
{ {
struct hstate *h; struct hstate *h;
struct page *page; struct page *page;
int ret = 0, idx = 0; int idx = 0;
do { do {
if (cgroup_task_count(cgroup) ||
!list_empty(&cgroup->children)) {
ret = -EBUSY;
goto out;
}
for_each_hstate(h) { for_each_hstate(h) {
spin_lock(&hugetlb_lock); spin_lock(&hugetlb_lock);
list_for_each_entry(page, &h->hugepage_activelist, lru) list_for_each_entry(page, &h->hugepage_activelist, lru)
...@@ -177,8 +172,6 @@ static int hugetlb_cgroup_pre_destroy(struct cgroup *cgroup) ...@@ -177,8 +172,6 @@ static int hugetlb_cgroup_pre_destroy(struct cgroup *cgroup)
} }
cond_resched(); cond_resched();
} while (hugetlb_cgroup_have_usage(cgroup)); } while (hugetlb_cgroup_have_usage(cgroup));
out:
return ret;
} }
int hugetlb_cgroup_charge_cgroup(int idx, unsigned long nr_pages, int hugetlb_cgroup_charge_cgroup(int idx, unsigned long nr_pages,
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment