diff mbox series

[3/5] Memcgroup:add a global work

Message ID 1547955021-11520-4-git-send-email-duanxiongchun@bytedance.com (mailing list archive)
State New, archived
Headers show
Series fix offline memcgroup still hold in memory | expand

Commit Message

Xiongchun Duan Jan. 20, 2019, 3:30 a.m. UTC
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(-)

Comments

kernel test robot Jan. 21, 2019, 6:38 p.m. UTC | #1
Hi Xiongchun,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v5.0-rc2 next-20190116]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Xiongchun-Duan/Memcgroup-force-empty-after-memcgroup-offline/20190122-014721
config: i386-randconfig-x010-201903 (attached as .config)
compiler: gcc-8 (Debian 8.2.0-14) 8.2.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All errors (new ones prefixed by >>):

   mm/memcontrol.c: In function 'empty_timer_trigger':
>> mm/memcontrol.c:4585:13: error: 'memcg_force_empty_wq' undeclared (first use in this function); did you mean 'mem_cgroup_force_empty'?
     queue_work(memcg_force_empty_wq, &timer_poll_work);
                ^~~~~~~~~~~~~~~~~~~~
                mem_cgroup_force_empty
   mm/memcontrol.c:4585:13: note: each undeclared identifier is reported only once for each function it appears in
   mm/memcontrol.c: In function 'mem_cgroup_init':
   mm/memcontrol.c:6400:2: error: 'memcg_force_empty_wq' undeclared (first use in this function); did you mean 'mem_cgroup_force_empty'?
     memcg_force_empty_wq = alloc_workqueue("memcg_force_empty_wq", 0, 1);
     ^~~~~~~~~~~~~~~~~~~~
     mem_cgroup_force_empty

vim +4585 mm/memcontrol.c

  4582	
  4583	static void empty_timer_trigger(struct timer_list *t)
  4584	{
> 4585		queue_work(memcg_force_empty_wq, &timer_poll_work);
  4586	}
  4587	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
kernel test robot Jan. 21, 2019, 10:35 p.m. UTC | #2
Hi Xiongchun,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v5.0-rc2 next-20190116]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Xiongchun-Duan/Memcgroup-force-empty-after-memcgroup-offline/20190122-014721
config: x86_64-randconfig-r0-01212129 (attached as .config)
compiler: gcc-6 (Debian 6.4.0-9) 6.4.0 20171026
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

   mm/memcontrol.c: In function 'empty_timer_trigger':
>> mm/memcontrol.c:4585:13: error: 'memcg_force_empty_wq' undeclared (first use in this function)
     queue_work(memcg_force_empty_wq, &timer_poll_work);
                ^~~~~~~~~~~~~~~~~~~~
   mm/memcontrol.c:4585:13: note: each undeclared identifier is reported only once for each function it appears in
   mm/memcontrol.c: In function 'mem_cgroup_init':
   mm/memcontrol.c:6400:2: error: 'memcg_force_empty_wq' undeclared (first use in this function)
     memcg_force_empty_wq = alloc_workqueue("memcg_force_empty_wq", 0, 1);
     ^~~~~~~~~~~~~~~~~~~~

vim +/memcg_force_empty_wq +4585 mm/memcontrol.c

  4582	
  4583	static void empty_timer_trigger(struct timer_list *t)
  4584	{
> 4585		queue_work(memcg_force_empty_wq, &timer_poll_work);
  4586	}
  4587	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
diff mbox series

Patch

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,