108 lines
3.9 KiB
Diff
108 lines
3.9 KiB
Diff
|
From a672fb44791bab2e0b7cd519fbb55751fb2fbe16 Mon Sep 17 00:00:00 2001
|
||
|
From: Arjan van de Ven <arjan@linux.intel.com>
|
||
|
Date: Fri, 28 Aug 2015 11:00:36 -0500
|
||
|
Subject: [PATCH 07/22] cgroup
|
||
|
|
||
|
Author: Arjan van de Ven <arjan@linux.intel.com>
|
||
|
|
||
|
Signed-off-by: Miguel Bernal Marin <miguel.bernal.marin@linux.intel.com>
|
||
|
Signed-off-by: Jose Carlos Venegas Munoz <jos.c.venegas.munoz@intel.com>
|
||
|
---
|
||
|
include/linux/cgroup-defs.h | 2 +-
|
||
|
kernel/cgroup.c | 24 ++++++++++++++----------
|
||
|
2 files changed, 15 insertions(+), 11 deletions(-)
|
||
|
|
||
|
diff --git a/include/linux/cgroup-defs.h b/include/linux/cgroup-defs.h
|
||
|
index 6fb1c34c..f5ffee9d 100644
|
||
|
--- a/include/linux/cgroup-defs.h
|
||
|
+++ b/include/linux/cgroup-defs.h
|
||
|
@@ -137,7 +137,7 @@ struct cgroup_subsys_state {
|
||
|
|
||
|
/* percpu_ref killing and RCU release */
|
||
|
struct rcu_head rcu_head;
|
||
|
- struct work_struct destroy_work;
|
||
|
+ struct delayed_work destroy_work;
|
||
|
};
|
||
|
|
||
|
/*
|
||
|
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
|
||
|
index 4c233437..27a71a9e 100644
|
||
|
--- a/kernel/cgroup.c
|
||
|
+++ b/kernel/cgroup.c
|
||
|
@@ -73,7 +73,7 @@
|
||
|
* Expiring in the middle is a performance problem not a correctness one.
|
||
|
* 1 sec should be enough.
|
||
|
*/
|
||
|
-#define CGROUP_PIDLIST_DESTROY_DELAY HZ
|
||
|
+#define CGROUP_PIDLIST_DESTROY_DELAY round_jiffies_relative(HZ)
|
||
|
|
||
|
#define CGROUP_FILE_NAME_MAX (MAX_CGROUP_TYPE_NAMELEN + \
|
||
|
MAX_CFTYPE_NAME + 2)
|
||
|
@@ -4987,8 +4987,9 @@ static struct cftype cgroup_legacy_base_files[] = {
|
||
|
*/
|
||
|
static void css_free_work_fn(struct work_struct *work)
|
||
|
{
|
||
|
+ struct delayed_work *dwork = to_delayed_work(work);
|
||
|
struct cgroup_subsys_state *css =
|
||
|
- container_of(work, struct cgroup_subsys_state, destroy_work);
|
||
|
+ container_of(dwork, struct cgroup_subsys_state, destroy_work);
|
||
|
struct cgroup_subsys *ss = css->ss;
|
||
|
struct cgroup *cgrp = css->cgroup;
|
||
|
|
||
|
@@ -5037,14 +5038,15 @@ static void css_free_rcu_fn(struct rcu_head *rcu_head)
|
||
|
struct cgroup_subsys_state *css =
|
||
|
container_of(rcu_head, struct cgroup_subsys_state, rcu_head);
|
||
|
|
||
|
- INIT_WORK(&css->destroy_work, css_free_work_fn);
|
||
|
- queue_work(cgroup_destroy_wq, &css->destroy_work);
|
||
|
+ INIT_DELAYED_WORK(&css->destroy_work, css_free_work_fn);
|
||
|
+ queue_delayed_work(cgroup_destroy_wq, &css->destroy_work, CGROUP_PIDLIST_DESTROY_DELAY);
|
||
|
}
|
||
|
|
||
|
static void css_release_work_fn(struct work_struct *work)
|
||
|
{
|
||
|
+ struct delayed_work *dwork = to_delayed_work(work);
|
||
|
struct cgroup_subsys_state *css =
|
||
|
- container_of(work, struct cgroup_subsys_state, destroy_work);
|
||
|
+ container_of(dwork, struct cgroup_subsys_state, destroy_work);
|
||
|
struct cgroup_subsys *ss = css->ss;
|
||
|
struct cgroup *cgrp = css->cgroup;
|
||
|
|
||
|
@@ -5087,8 +5089,9 @@ static void css_release(struct percpu_ref *ref)
|
||
|
struct cgroup_subsys_state *css =
|
||
|
container_of(ref, struct cgroup_subsys_state, refcnt);
|
||
|
|
||
|
- INIT_WORK(&css->destroy_work, css_release_work_fn);
|
||
|
- queue_work(cgroup_destroy_wq, &css->destroy_work);
|
||
|
+ INIT_DELAYED_WORK(&css->destroy_work, css_release_work_fn);
|
||
|
+ queue_delayed_work(cgroup_destroy_wq, &css->destroy_work, CGROUP_PIDLIST_DESTROY_DELAY);
|
||
|
+
|
||
|
}
|
||
|
|
||
|
static void init_and_link_css(struct cgroup_subsys_state *css,
|
||
|
@@ -5367,8 +5370,9 @@ static int cgroup_mkdir(struct kernfs_node *parent_kn, const char *name,
|
||
|
*/
|
||
|
static void css_killed_work_fn(struct work_struct *work)
|
||
|
{
|
||
|
+ struct delayed_work *dwork = to_delayed_work(work);
|
||
|
struct cgroup_subsys_state *css =
|
||
|
- container_of(work, struct cgroup_subsys_state, destroy_work);
|
||
|
+ container_of(dwork, struct cgroup_subsys_state, destroy_work);
|
||
|
|
||
|
mutex_lock(&cgroup_mutex);
|
||
|
|
||
|
@@ -5389,8 +5393,8 @@ static void css_killed_ref_fn(struct percpu_ref *ref)
|
||
|
container_of(ref, struct cgroup_subsys_state, refcnt);
|
||
|
|
||
|
if (atomic_dec_and_test(&css->online_cnt)) {
|
||
|
- INIT_WORK(&css->destroy_work, css_killed_work_fn);
|
||
|
- queue_work(cgroup_destroy_wq, &css->destroy_work);
|
||
|
+ INIT_DELAYED_WORK(&css->destroy_work, css_killed_work_fn);
|
||
|
+ queue_delayed_work(cgroup_destroy_wq, &css->destroy_work, CGROUP_PIDLIST_DESTROY_DELAY);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
--
|
||
|
2.11.0
|
||
|
|