[Devel] [PATCH v3 rh7 2/2] mm/page-writeback: Introduce per-CT dirty memory limit.

Vladimir Davydov vdavydov at virtuozzo.com
Thu Jan 21 03:04:22 PST 2016


On Thu, Jan 21, 2016 at 01:55:32PM +0300, Andrey Ryabinin wrote:
> 
> 
> On 01/21/2016 01:35 PM, Vladimir Davydov wrote:
> >> +		if (ub_dirty + ub_writeback <= ub_thresh)
> >> +			break;
> >> +		if (!writeback_in_progress(bdi))
> >> +			bdi_start_background_writeback(bdi);
> >> +
> >> +		/*
> >> +		 * Throttle it only when the background writeback cannot
> >> +		 * catch-up. This avoids (excessively) small writeouts
> >> +		 * when the bdi limits are ramping up.
> >> +		 */
> >> +		if (ub_dirty + ub_writeback <
> >> +			(ub_background_thresh + ub_thresh) / 2)
> >> +			break;
> >> +
> >> +		if (ub_dirty > ub_thresh) {
> >> +			pages_written = writeback_inodes_wb(&bdi->wb, write_chunk,
> > 
> > You need to subtract the number of pages written from write_chunk here,
> > obviously.
> > 
> 
> Hm... I think you're bit wrong here. We shouldn't change write_chunk.
> I did the following:
> 
> diff --git a/mm/page-writeback.c b/mm/page-writeback.c
> index 951330e..090b6e6 100644
> --- a/mm/page-writeback.c
> +++ b/mm/page-writeback.c
> @@ -1403,6 +1403,8 @@ static void balance_dirty_pages_ub(struct address_space *mapping,
>         struct backing_dev_info *bdi = mapping->backing_dev_info;
>  
>         for (;;) {
> +               unsigned long nr_to_write = write_chunk;
> +
>                 ub_dirty = ub_stat_get(ub, dirty_pages);
>                 ub_writeback = ub_stat_get(ub, writeback_pages);
>  
> 
> @@ -1428,8 +1430,10 @@ static void balance_dirty_pages_ub(struct address_space *mapping,
>                         break;
>  
>                 if (ub_dirty > ub_thresh) {
> -                       pages_written = writeback_inodes_wb(&bdi->wb, write_chunk,
> -                                       WB_REASON_BACKGROUND, ub);
> +                       pages_written += writeback_inodes_wb(&bdi->wb,
> +                                                       nr_to_write,

- nr_to_write,
+ write_chunk - pages_written,

> +                                                       WB_REASON_BACKGROUND,
> +                                                       ub);
>                         ub_dirty = ub_stat_get(ub, dirty_pages);
>                         ub_writeback = ub_stat_get(ub, writeback_pages);
> 
> 


More information about the Devel mailing list