Re: [PATCH 3/5] Memcgroup:add a global work

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat 19-01-19 22:30:19, Xiongchun Duan wrote:
> Add a global work to scan offline cgroup and trigger
> offline cgroup force empty.

Why is kswapd not sufficient? And again, a new infrastructure should be
added with its users. Who is supposed to trigger_force_empty?

> 
> Signed-off-by: Xiongchun Duan <duanxiongchun@xxxxxxxxxxxxx>
> ---
>  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

-- 
Michal Hocko
SUSE Labs



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [Monitors]

  Powered by Linux