public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Zheng Da <zhengda1936@gmail.com>
Cc: xfs@oss.sgi.com
Subject: Re: concurrent direct IO write in xfs
Date: Thu, 26 Jan 2012 09:25:17 +1100	[thread overview]
Message-ID: <20120125222517.GS15102@dastard> (raw)
In-Reply-To: <CAFLer83=QBG-eCT__sJY5hd7tvKjAX20-kMODqBXuYh1KqjOrw@mail.gmail.com>

On Wed, Jan 25, 2012 at 04:20:12PM -0500, Zheng Da wrote:
> Hello Dave,
> 
> On Mon, Jan 23, 2012 at 10:54 PM, Dave Chinner <david@fromorbit.com> wrote:
> >
> > > >> > So the test case is pretty simple and I think it's easy to
> > reproduce it.
> > > >> > It'll be great if you can try the test case.
> > > >>
> > > >> Can you post your test code so I know what I test is exactly what
> > > >> you are running?
> > > >>
> > > > I can do that. My test code gets very complicated now. I need to
> > simplify
> > > > it.
> > > >
> > > Here is the code. It's still a bit long. I hope it's OK.
> > > You can run the code like "rand-read file option=direct pages=1048576
> > > threads=8 access=write/read".
> >
> > With 262144 pages on a 2Gb ramdisk, the results I get on 3.2.0 are
> >
> > Threads         Read    Write
> >    1           0.92s   1.49s
> >    2           0.51s   1.20s
> >    4           0.31s   1.34s
> >    8           0.22s   1.59s
> >   16           0.23s   2.24s
> >
> > the contention is on the ip->i_ilock, and the newsize update is one
> > of the offenders It probably needs this change to
> > xfs_aio_write_newsize_update():
> >
> > -        if (new_size == ip->i_new_size) {
> > +        if (new_size && new_size == ip->i_new_size) {
> >
> > to avoid the lock being taken here.
> >
> > But all that newsize crap is gone in the current git Linus tree,
> > so how much would that gains us:
> >
> > Threads         Read    Write
> >    1           0.88s   0.85s
> >    2           0.54s   1.20s
> >    4           0.31s   1.23s
> >    8           0.27s   1.40s
> >   16           0.25s   2.36s
> >
> > Pretty much nothing. IOWs, it's just like I suspected - you are
> > doing so many write IOs that you are serialising on the extent
> > lookup and write checks which use exclusive locking..
> >
> > Given that it is 2 lock traversals per write IO, we're limiting at
> > about 4-500,000 exclusive lock grabs per second and decreasing as
> > contention goes up.
> >
> > For reads, we are doing 2 shared (nested) lookups per read IO, we
> > appear to be limiting at around 2,000,000 shared lock grabs per
> > second. Ahmdals law is kicking in here, but it means if we could
> > make the writes to use a shared lock, it would at least scale like
> > the reads for this "no metadata modification except for mtime"
> > overwrite case.
> >
> > I don't think that the generic write checks absolutely need
> > exclusive locking - we probably could get away with a shared lock
> > and only fall back to exclusive when we need to do EOF zeroing.
> > Similarly, for the block mapping code if we don't need to do
> > allocation, a shared lock is all we need. So maybe in that case for
> > direct IO when create == 1, we can do a read lookup first and only
> > grab the lock exclusively if that falls in a hole and requires
> > allocation.....
> 
> 
> Do you think if you will provide a patch for the changes?

I'm still thinking on it. I do have other work to do right now, so
this is low priority. If it appears safe to do, then I'll write a
patch and propose it. If it can't be made safe for all cases, then
you'll have to think of some other way to achieve what you want from
your application.

Cheers,

Dave.

-- 
Dave Chinner
david@fromorbit.com

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

  reply	other threads:[~2012-01-25 22:25 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-16  0:01 concurrent direct IO write in xfs Zheng Da
2012-01-16 17:48 ` Christoph Hellwig
2012-01-16 19:44   ` Zheng Da
2012-01-16 23:25 ` Dave Chinner
2012-01-17 19:19   ` Zheng Da
2012-01-20  8:53     ` Linda Walsh
2012-01-20 15:07       ` Zheng Da
2012-01-23  5:11     ` Dave Chinner
2012-01-23 19:34       ` Zheng Da
2012-01-23 20:51         ` Zheng Da
2012-01-24  0:34           ` Stan Hoeppner
2012-01-24  1:40             ` Zheng Da
2012-01-24  3:54           ` Dave Chinner
2012-01-25 21:20             ` Zheng Da
2012-01-25 22:25               ` Dave Chinner [this message]
2012-02-09  6:09             ` Dave Chinner
2012-02-09  6:44               ` Zheng Da
2012-02-13 17:48               ` Christoph Hellwig
2012-02-13 23:07                 ` Dave Chinner

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=20120125222517.GS15102@dastard \
    --to=david@fromorbit.com \
    --cc=xfs@oss.sgi.com \
    --cc=zhengda1936@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox