From: Xiongchun Duan <duanxiongchun@bytedance.com>
To: cgroups@vger.kernel.org, linux-mm@kvack.org
Cc: shy828301@gmail.com, mhocko@kernel.org, tj@kernel.org,
hannes@cmpxchg.org, zhangyongsu@bytedance.com,
liuxiaozhou@bytedance.com, zhengfeiran@bytedance.com,
wangdongdong.6@bytedance.com,
Xiongchun Duan <duanxiongchun@bytedance.com>
Subject: [PATCH 3/5] Memcgroup:add a global work
Date: Sat, 19 Jan 2019 22:30:19 -0500 [thread overview]
Message-ID: <1547955021-11520-4-git-send-email-duanxiongchun@bytedance.com> (raw)
In-Reply-To: <1547955021-11520-1-git-send-email-duanxiongchun@bytedance.com>
Add a global work to scan offline cgroup and trigger
offline cgroup force empty.
Signed-off-by: Xiongchun Duan <duanxiongchun@bytedance.com>
---
mm/memcontrol.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 4db08b7..fad1aae 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -82,6 +82,7 @@
int sysctl_cgroup_default_retry_max = 16;
struct timer_list empty_trigger;
+struct work_struct timer_poll_work;
struct mem_cgroup *root_mem_cgroup __read_mostly;
@@ -320,6 +321,7 @@ void memcg_put_cache_ids(void)
EXPORT_SYMBOL(memcg_kmem_enabled_key);
struct workqueue_struct *memcg_kmem_cache_wq;
+struct workqueue_struct *memcg_force_empty_wq;
static int memcg_shrinker_map_size;
static DEFINE_MUTEX(memcg_shrinker_map_mutex);
@@ -4573,11 +4575,16 @@ static int mem_cgroup_css_online(struct cgroup_subsys_state *css)
return 0;
}
-void empty_timer_trigger(struct timer_list *t)
+static void trigger_force_empty(struct work_struct *work)
{
}
+static void empty_timer_trigger(struct timer_list *t)
+{
+ queue_work(memcg_force_empty_wq, &timer_poll_work);
+}
+
static void mem_cgroup_css_offline(struct cgroup_subsys_state *css)
{
struct mem_cgroup *memcg = mem_cgroup_from_css(css);
@@ -6390,6 +6397,9 @@ static int __init mem_cgroup_init(void)
memcg_kmem_cache_wq = alloc_workqueue("memcg_kmem_cache", 0, 1);
BUG_ON(!memcg_kmem_cache_wq);
#endif
+ memcg_force_empty_wq = alloc_workqueue("memcg_force_empty_wq", 0, 1);
+ BUG_ON(!memcg_force_empty_wq);
+ INIT_WORK(&timer_poll_work, trigger_force_empty);
timer_setup(&empty_trigger, empty_timer_trigger, 0);
cpuhp_setup_state_nocalls(CPUHP_MM_MEMCQ_DEAD, "mm/memctrl:dead", NULL,
--
1.8.3.1
next prev parent reply other threads:[~2019-01-20 3:31 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-20 3:30 [PATCH 0/5] fix offline memcgroup still hold in memory Xiongchun Duan
2019-01-20 3:30 ` [PATCH 1/5] Memcgroup: force empty after memcgroup offline Xiongchun Duan
2019-01-21 18:52 ` kbuild test robot
2019-01-21 18:52 ` kbuild test robot
2019-01-21 19:09 ` kbuild test robot
2019-01-21 19:09 ` kbuild test robot
2019-01-20 3:30 ` [PATCH 2/5] Memcgroup: Add timer to trigger workqueue Xiongchun Duan
2019-01-20 18:05 ` Michal Hocko
2019-01-20 3:30 ` Xiongchun Duan [this message]
2019-01-21 18:38 ` [PATCH 3/5] Memcgroup:add a global work kbuild test robot
2019-01-21 18:38 ` kbuild test robot
2019-01-21 22:35 ` kbuild test robot
2019-01-21 22:35 ` kbuild test robot
2019-01-20 3:30 ` [PATCH 4/5] Memcgroup:Implement force empty work function Xiongchun Duan
2019-01-20 3:30 ` [PATCH 5/5] Memcgroup:add cgroup fs to show offline memcgroup status Xiongchun Duan
2019-01-20 18:12 ` [PATCH 0/5] fix offline memcgroup still hold in memory Michal Hocko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1547955021-11520-4-git-send-email-duanxiongchun@bytedance.com \
--to=duanxiongchun@bytedance.com \
--cc=cgroups@vger.kernel.org \
--cc=hannes@cmpxchg.org \
--cc=linux-mm@kvack.org \
--cc=liuxiaozhou@bytedance.com \
--cc=mhocko@kernel.org \
--cc=shy828301@gmail.com \
--cc=tj@kernel.org \
--cc=wangdongdong.6@bytedance.com \
--cc=zhangyongsu@bytedance.com \
--cc=zhengfeiran@bytedance.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox