All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Jan Kara <jack@suse.cz>
Cc: Al Viro <viro@ZenIV.linux.org.uk>,
	Wu Fengguang <fengguang.wu@intel.com>,
	linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH v2] writeback: Do not sync data dirtied after sync start
Date: Fri, 27 Sep 2013 10:55:53 +1000	[thread overview]
Message-ID: <20130927005553.GV26872@dastard> (raw)
In-Reply-To: <1380223438-26381-1-git-send-email-jack@suse.cz>

On Thu, Sep 26, 2013 at 09:23:58PM +0200, Jan Kara wrote:
> When there are processes heavily creating small files while sync(2) is
> running, it can easily happen that quite some new files are created
> between WB_SYNC_NONE and WB_SYNC_ALL pass of sync(2). That can happen
> especially if there are several busy filesystems (remember that sync
> traverses filesystems sequentially and waits in WB_SYNC_ALL phase on one
> fs before starting it on another fs). Because WB_SYNC_ALL pass is slow
> (e.g. causes a transaction commit and cache flush for each inode in
> ext3), resulting sync(2) times are rather large.

Yup, that can be a problem.

Build warning form the patch:

In file included from include/trace/ftrace.h:575:0,
                 from include/trace/define_trace.h:90,
                 from include/trace/events/writeback.h:603,
                 from fs/fs-writeback.c:89:
include/trace/events/writeback.h: In function ¿ftrace_raw_event_writeback_queue_io¿:
include/trace/events/writeback.h:277:1: warning: initialization makes pointer from integer without a cast [enabled by default]
In file included from include/trace/ftrace.h:711:0,
                 from include/trace/define_trace.h:90,
                 from include/trace/events/writeback.h:603,
                 from fs/fs-writeback.c:89:
include/trace/events/writeback.h: In function ¿perf_trace_writeback_queue_io¿:
include/trace/events/writeback.h:277:1: warning: initialization makes pointer from integer without a cast [enabled by default]

> The following script reproduces the problem:
> 
> function run_writers
> {
>   for (( i = 0; i < 10; i++ )); do
>     mkdir $1/dir$i
>     for (( j = 0; j < 40000; j++ )); do
>       dd if=/dev/zero of=$1/dir$i/$j bs=4k count=4 &>/dev/null
>     done &
>   done
> }
> 
> for dir in "$@"; do
>   run_writers $dir
> done
> 
> sleep 40
> time sync
> ======
> 
> Fix the problem by disregarding inodes dirtied after sync(2) was called
> in the WB_SYNC_ALL pass. To allow for this, sync_inodes_sb() now takes a
> time stamp when sync has started which is used for setting up work for
> flusher threads.
> 
> To give some numbers, when above script is run on two ext4 filesystems on
> simple SATA drive, the average sync time from 10 runs is 267.549 seconds
> with standard deviation 104.799426. With the patched kernel, the average
> sync time from 10 runs is 2.995 seconds with standard deviation 0.096.

Hmmmm. 2.8 seconds on my XFS perf VM without the patch. Ok, try a
smaller VM backed by single spindle of spinning rust rather than
SSDs. Over 10 runs I see:

kernel		min	max	av
vanilla		0.18s	4.46s	1.63s
patched		0.14s	0.45s	0.28s

Definitely an improvement, but nowhere near the numbers you are
seeing for ext4 - maybe XFS isn't as susceptible to this problem
as ext4. Nope, ext4 on an unpatched kernel gives 1.66/6.81/3.12s,
(which is less than your patched kernel results :) but means
so it must be something else configuration/hardware related.

Anyway, the change looks good, it just needs the above warning fixed...

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2013-09-27  0:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-26 19:23 [PATCH v2] writeback: Do not sync data dirtied after sync start Jan Kara
2013-09-27  0:55 ` Dave Chinner [this message]
2013-09-27  9:37   ` Jan Kara
2013-09-27 23:22     ` Dave Chinner
2013-09-28  0:31 ` Fengguang Wu
2013-09-30  9:31   ` Jan Kara
2013-10-03 13:20     ` Fengguang Wu

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=20130927005553.GV26872@dastard \
    --to=david@fromorbit.com \
    --cc=fengguang.wu@intel.com \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=viro@ZenIV.linux.org.uk \
    /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.