All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wu Fengguang <fengguang.wu@intel.com>
To: Dave Chinner <david@fromorbit.com>
Cc: linux-fsdevel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org, xfs@oss.sgi.com
Subject: Re: [PATCH] writeback: write_cache_pages doesn't terminate at nr_to_write <= 0
Date: Mon, 23 Aug 2010 16:27:47 +0800	[thread overview]
Message-ID: <20100823082747.GB4970@localhost> (raw)
In-Reply-To: <1282538620-10824-1-git-send-email-david@fromorbit.com>

On Mon, Aug 23, 2010 at 02:43:40PM +1000, Dave Chinner wrote:
> From: Dave Chinner <dchinner@redhat.com>
> 
> I noticed XFS writeback in 2.6.36-rc1 was much slower than it should have
> been. Enabling writeback tracing showed:
> 
>     flush-253:16-8516  [007] 1342952.351608: wbc_writepage: bdi 253:16: towrt=1024 skip=0 mode=0 kupd=0 bgrd=1 reclm=0 cyclic=1 more=0 older=0x0 start=0x0 end=0x0
>     flush-253:16-8516  [007] 1342952.351654: wbc_writepage: bdi 253:16: towrt=1023 skip=0 mode=0 kupd=0 bgrd=1 reclm=0 cyclic=1 more=0 older=0x0 start=0x0 end=0x0
>     flush-253:16-8516  [000] 1342952.369520: wbc_writepage: bdi 253:16: towrt=0 skip=0 mode=0 kupd=0 bgrd=1 reclm=0 cyclic=1 more=0 older=0x0 start=0x0 end=0x0
>     flush-253:16-8516  [000] 1342952.369542: wbc_writepage: bdi 253:16: towrt=-1 skip=0 mode=0 kupd=0 bgrd=1 reclm=0 cyclic=1 more=0 older=0x0 start=0x0 end=0x0
>     flush-253:16-8516  [000] 1342952.369549: wbc_writepage: bdi 253:16: towrt=-2 skip=0 mode=0 kupd=0 bgrd=1 reclm=0 cyclic=1 more=0 older=0x0 start=0x0 end=0x0
> 
> Writeback is not terminating in background writeback if ->writepage is
> returning with wbc->nr_to_write == 0, resulting in sub-optimal single page
> writeback on XFS.

The new code looks more simple, and more robust in case ->writepage 
modifies wbc->nr_to_write (as in xfs_vm_writepage).

Reviewed-by: Wu Fengguang <fengguang.wu@intel.com>

Thanks,
Fengguang

> Fix the write_cache_pages loop to terminate correctly when this situation
> occurs and so prevent this sub-optimal background writeback pattern. This
> improves sustained sequential buffered write performance from around
> 250MB/s to 750MB/s for a 100GB file on an XFS filesystem on my 8p test VM.
> 
> Signed-off-by: Dave Chinner <dchinner@redhat.com>
> ---
>  mm/page-writeback.c |   26 ++++++++++----------------
>  1 files changed, 10 insertions(+), 16 deletions(-)
> 
> diff --git a/mm/page-writeback.c b/mm/page-writeback.c
> index 7262aac..f069782 100644
> --- a/mm/page-writeback.c
> +++ b/mm/page-writeback.c
> @@ -984,22 +984,16 @@ continue_unlock:
>  				}
>  			}
>  
> -			if (wbc->nr_to_write > 0) {
> -				if (--wbc->nr_to_write == 0 &&
> -				    wbc->sync_mode == WB_SYNC_NONE) {
> -					/*
> -					 * We stop writing back only if we are
> -					 * not doing integrity sync. In case of
> -					 * integrity sync we have to keep going
> -					 * because someone may be concurrently
> -					 * dirtying pages, and we might have
> -					 * synced a lot of newly appeared dirty
> -					 * pages, but have not synced all of the
> -					 * old dirty pages.
> -					 */
> -					done = 1;
> -					break;
> -				}
> +			/*
> +			 * We stop writing back only if we are not doing
> +			 * integrity sync. In case of integrity sync we have to
> +			 * keep going until we have written all the pages
> +			 * we tagged for writeback prior to entering this loop.
> +			 */
> +			if (--wbc->nr_to_write <= 0 &&
> +			    wbc->sync_mode == WB_SYNC_NONE) {
> +				done = 1;
> +				break;
>  			}
>  		}
>  		pagevec_release(&pvec);
> -- 
> 1.7.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

WARNING: multiple messages have this Message-ID (diff)
From: Wu Fengguang <fengguang.wu@intel.com>
To: Dave Chinner <david@fromorbit.com>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	xfs@oss.sgi.com, Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] writeback: write_cache_pages doesn't terminate at nr_to_write <= 0
Date: Mon, 23 Aug 2010 16:27:47 +0800	[thread overview]
Message-ID: <20100823082747.GB4970@localhost> (raw)
In-Reply-To: <1282538620-10824-1-git-send-email-david@fromorbit.com>

On Mon, Aug 23, 2010 at 02:43:40PM +1000, Dave Chinner wrote:
> From: Dave Chinner <dchinner@redhat.com>
> 
> I noticed XFS writeback in 2.6.36-rc1 was much slower than it should have
> been. Enabling writeback tracing showed:
> 
>     flush-253:16-8516  [007] 1342952.351608: wbc_writepage: bdi 253:16: towrt=1024 skip=0 mode=0 kupd=0 bgrd=1 reclm=0 cyclic=1 more=0 older=0x0 start=0x0 end=0x0
>     flush-253:16-8516  [007] 1342952.351654: wbc_writepage: bdi 253:16: towrt=1023 skip=0 mode=0 kupd=0 bgrd=1 reclm=0 cyclic=1 more=0 older=0x0 start=0x0 end=0x0
>     flush-253:16-8516  [000] 1342952.369520: wbc_writepage: bdi 253:16: towrt=0 skip=0 mode=0 kupd=0 bgrd=1 reclm=0 cyclic=1 more=0 older=0x0 start=0x0 end=0x0
>     flush-253:16-8516  [000] 1342952.369542: wbc_writepage: bdi 253:16: towrt=-1 skip=0 mode=0 kupd=0 bgrd=1 reclm=0 cyclic=1 more=0 older=0x0 start=0x0 end=0x0
>     flush-253:16-8516  [000] 1342952.369549: wbc_writepage: bdi 253:16: towrt=-2 skip=0 mode=0 kupd=0 bgrd=1 reclm=0 cyclic=1 more=0 older=0x0 start=0x0 end=0x0
> 
> Writeback is not terminating in background writeback if ->writepage is
> returning with wbc->nr_to_write == 0, resulting in sub-optimal single page
> writeback on XFS.

The new code looks more simple, and more robust in case ->writepage 
modifies wbc->nr_to_write (as in xfs_vm_writepage).

Reviewed-by: Wu Fengguang <fengguang.wu@intel.com>

Thanks,
Fengguang

> Fix the write_cache_pages loop to terminate correctly when this situation
> occurs and so prevent this sub-optimal background writeback pattern. This
> improves sustained sequential buffered write performance from around
> 250MB/s to 750MB/s for a 100GB file on an XFS filesystem on my 8p test VM.
> 
> Signed-off-by: Dave Chinner <dchinner@redhat.com>
> ---
>  mm/page-writeback.c |   26 ++++++++++----------------
>  1 files changed, 10 insertions(+), 16 deletions(-)
> 
> diff --git a/mm/page-writeback.c b/mm/page-writeback.c
> index 7262aac..f069782 100644
> --- a/mm/page-writeback.c
> +++ b/mm/page-writeback.c
> @@ -984,22 +984,16 @@ continue_unlock:
>  				}
>  			}
>  
> -			if (wbc->nr_to_write > 0) {
> -				if (--wbc->nr_to_write == 0 &&
> -				    wbc->sync_mode == WB_SYNC_NONE) {
> -					/*
> -					 * We stop writing back only if we are
> -					 * not doing integrity sync. In case of
> -					 * integrity sync we have to keep going
> -					 * because someone may be concurrently
> -					 * dirtying pages, and we might have
> -					 * synced a lot of newly appeared dirty
> -					 * pages, but have not synced all of the
> -					 * old dirty pages.
> -					 */
> -					done = 1;
> -					break;
> -				}
> +			/*
> +			 * We stop writing back only if we are not doing
> +			 * integrity sync. In case of integrity sync we have to
> +			 * keep going until we have written all the pages
> +			 * we tagged for writeback prior to entering this loop.
> +			 */
> +			if (--wbc->nr_to_write <= 0 &&
> +			    wbc->sync_mode == WB_SYNC_NONE) {
> +				done = 1;
> +				break;
>  			}
>  		}
>  		pagevec_release(&pvec);
> -- 
> 1.7.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

  reply	other threads:[~2010-08-23  8:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-23  4:43 [PATCH] writeback: write_cache_pages doesn't terminate at nr_to_write <= 0 Dave Chinner
2010-08-23  4:43 ` Dave Chinner
2010-08-23  8:27 ` Wu Fengguang [this message]
2010-08-23  8:27   ` Wu Fengguang
2010-08-23 13:25 ` Christoph Hellwig
2010-08-23 13:25   ` Christoph Hellwig

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=20100823082747.GB4970@localhost \
    --to=fengguang.wu@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@fromorbit.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=xfs@oss.sgi.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.