答复: [PATCH] fs/writeback: do memory cgroup related writeback firstly

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

 



Ping

-RongQing

> -----邮件原件-----
> 发件人: linux-fsdevel-owner@xxxxxxxxxxxxxxx [mailto:linux-fsdevel-
> owner@xxxxxxxxxxxxxxx] 代表 Li RongQing
> 发送时间: 2018年7月4日 16:58
> 收件人: linux-fsdevel@xxxxxxxxxxxxxxx; linux-mm@xxxxxxxxx
> 抄送: viro@xxxxxxxxxxxxxxxxxx
> 主题: [PATCH] fs/writeback: do memory cgroup related writeback firstly
> 
> When a mechine has hundreds of memory cgroups, and some cgroups
> generate more or less dirty pages, but a cgroup of them has lots of memory
> pressure and always tries to reclaim dirty page, then it will trigger all cgroups
> to writeback, which is less efficient:
> 
> 1.if the used memory in a memory cgroup reaches its limit, it is useless to
> writeback other cgroups.
> 2.other cgroups can wait more time to merge write request
> 
> so replace the full flush with flushing writeback of memory cgroup whose
> tasks tries to reclaim memory and trigger writeback, if nothing is writeback,
> then start a full flush
> 
> Signed-off-by: Li RongQing <lirongqing@xxxxxxxxx>
> ---
>  fs/fs-writeback.c | 22 ++++++++++++++++++++++
>  1 file changed, 22 insertions(+)
> 
> diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index
> abafc9bd4622..a27efc4711a9 100644
> --- a/fs/fs-writeback.c
> +++ b/fs/fs-writeback.c
> @@ -2001,6 +2001,28 @@ void wakeup_flusher_threads(enum wb_reason
> reason)
>  	if (blk_needs_flush_plug(current))
>  		blk_schedule_flush_plug(current);
> 
> +#ifdef CONFIG_CGROUP_WRITEBACK
> +	if (reason == WB_REASON_VMSCAN) {
> +		int flush = 0;
> +
> +		rcu_read_lock();
> +		list_for_each_entry_rcu(bdi, &bdi_list, bdi_list) {
> +			struct bdi_writeback *wb = wb_find_current(bdi);
> +
> +			if (wb && wb != &bdi->wb) {
> +				if (wb_has_dirty_io(wb)) {
> +					wb_start_writeback(wb, reason);
> +					flush++;
> +				}
> +			}
> +		}
> +		rcu_read_unlock();
> +
> +		if (flush)
> +			return;
> +	}
> +#endif
> +
>  	rcu_read_lock();
>  	list_for_each_entry_rcu(bdi, &bdi_list, bdi_list)
>  		__wakeup_flusher_threads_bdi(bdi, reason);
> --
> 2.16.2





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

  Powered by Linux