From: Andi Kleen <andi@firstfloor.org>
To: Daniel Ehrenberg <dehrenberg@google.com>
Cc: Andi Kleen <andi@firstfloor.org>,
Alexander Viro <viro@zeniv.linux.org.uk>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] dio: Fast-path for page-aligned IOs
Date: Tue, 21 Jun 2011 23:44:13 +0200 [thread overview]
Message-ID: <20110621214413.GB3263@one.firstfloor.org> (raw)
In-Reply-To: <BANLkTi=GeY+6ZTKkYidFd+J=T7ER1+Lk6kv+uJe6GA6v1HrVaQ@mail.gmail.com>
On Tue, Jun 21, 2011 at 02:21:48PM -0700, Daniel Ehrenberg wrote:
> On Tue, Jun 21, 2011 at 1:41 PM, Andi Kleen <andi@firstfloor.org> wrote:
> > Dan Ehrenberg <dehrenberg@google.com> writes:
> >
> >> This code introduces a fast-path variant of __blockdev_direct_IO
> >> for the special case where the request size is a multiple of the page
> >> size, the inode block size is a page, the user memory is page-aligned,
> >> the underlying storage is contiguous on disk and the file location is
> >> already initialized. The special case decreases the amount of
> >> bookkeeping required, which saves a significant amount of CPU time on
> >> a fast device such as a ramdisk or an SSD. The patch is inspired by
> >> earlier code by Ken Chen.
> >
> > Is it understood why your fast path is that much faster?
> > i.e. what's the slow part in the normal path that it avoids?
> >
> > I am wondering if some of the improvements could be gotten even for less
> > rigid pre conditions.
>
> I should start by saying that I really should've submitted this with
> an [RFC] tag. I'm eager for feedback on my first Linux kernel patch,
> and I'm really glad you responded.
>
> The slowness in the dio code that I have observed is not in any
> particular place, but rather a death of a thousand cuts. Lines like
> memset(dio, 0, offsetof(struct dio, pages));
Hmm, is it cache miss stalls or just core cycles?
If the later I assume gcc generated an slow out of line call
for memset. I guess that would be fixable.
If the former maybe need a strategic prefetch?
Possibly a slab constructor would also help and avoid some of the
reinitialization costs (this would requirement a fixed size
limit for the fast path, but I guess that's reasonable)
> show up as significant in the CPU profile, but so do other random
> lines that manipulate the struct dio.
That would suggest cache misses?
So why does your version avoid those?
> You're right that these preconditions are rather rigid, though. If you
> have a suggestion for a more general precondition, I can try it out
> and see if it maintains the performance properties I want.
Not fully sure, but I would be interested in support for 512 byte sectors
at least.
-Andi
next prev parent reply other threads:[~2011-06-21 21:44 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-20 23:17 Dan Ehrenberg
2011-06-21 20:41 ` Andi Kleen
2011-06-21 21:21 ` Daniel Ehrenberg
2011-06-21 21:44 ` Andi Kleen [this message]
2011-07-27 21:08 ` Christoph Hellwig
2011-07-27 21:14 ` Andrew Morton
2011-07-27 22:15 ` Jeff Moyer
2011-07-28 22:09 ` Daniel Ehrenberg
2011-07-28 22:10 ` Daniel Ehrenberg
-- strict thread matches above, loose matches on Subject: below --
2011-06-20 22:44 Dan Ehrenberg
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=20110621214413.GB3263@one.firstfloor.org \
--to=andi@firstfloor.org \
--cc=akpm@linux-foundation.org \
--cc=dehrenberg@google.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®