linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Josef Bacik <jbacik@fusionio.com>
To: Liu Bo <liubo2009@cn.fujitsu.com>
Cc: Josef Bacik <JBacik@fusionio.com>,
	"linux-btrfs@vger.kernel.org" <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH RFC] Btrfs: improve multi-thread buffer read
Date: Wed, 11 Jul 2012 08:31:47 -0400	[thread overview]
Message-ID: <20120711123147.GH7529@localhost.localdomain> (raw)
In-Reply-To: <4FFCDDA3.4000002@cn.fujitsu.com>

On Tue, Jul 10, 2012 at 07:57:55PM -0600, Liu Bo wrote:
> On 07/11/2012 02:58 AM, Josef Bacik wrote:
> 
> > On Tue, Jul 10, 2012 at 05:27:59AM -0600, Liu Bo wrote:
> >> While testing with my buffer read fio jobs[1], I find that btrfs does not
> >> perform well enough.
> >>
> >> Here is a scenario in fio jobs:
> >>
> >> We have 4 threads, "t1 t2 t3 t4", starting to buffer read a same file,
> >> and all of them will race on add_to_page_cache_lru(), and if one thread
> >> successfully puts its page into the page cache, it takes the responsibility
> >> to read the page's data.
> >>
> >> And what's more, reading a page needs a period of time to finish, in which
> >> other threads can slide in and process rest pages:
> >>
> >>      t1          t2          t3          t4
> >>    add Page1
> >>    read Page1  add Page2
> >>      |         read Page2  add Page3
> >>      |            |        read Page3  add Page4
> >>      |            |           |        read Page4
> >> -----|------------|-----------|-----------|--------
> >>      v            v           v           v
> >>     bio          bio         bio         bio
> >>
> >> Now we have four bios, each of which holds only one page since we need to
> >> maintain consecutive pages in bio.  Thus, we can end up with far more bios
> >> than we need.
> >>
> >> Here we're going to
> >> a) delay the real read-page section and
> >> b) try to put more pages into page cache.
> >>
> >> With that said, we can make each bio hold more pages and reduce the number
> >> of bios we need.
> >>
> >> Here is some numbers taken from fio results:
> >>          w/o patch                 w patch
> >>        -------------  --------  ---------------
> >> READ:    745MB/s        +32%       987MB/s
> >>
> > 
> > Um, I have this in btrfs-next
> > 
> > Btrfs: use large extent range for read and its endio
> > 
> > that seems to do the same thing, did you not want to do that anymore?  Thanks,
> > 
> 
> 
> 
> I'm still hard working on that patchset. :)
> 
> Although the patchset is well worthy of testing, it is not good enough for btrfs upstream.
> 
> While doing some tuning work on it, I realized that I could make this improvement without
> the help of rwlock extent state stuff, so I made this smaller and cleaner patch for upstream
> so that we could gain some performance here first.
> 

So do you want me to drop the rwlock stuff and take this instead?  Take a look
at whats in btrfs-next and tell me what I should drop.  Thanks,

Josef

  reply	other threads:[~2012-07-11 12:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-10 11:27 [PATCH RFC] Btrfs: improve multi-thread buffer read Liu Bo
2012-07-10 18:58 ` Josef Bacik
2012-07-11  1:57   ` Liu Bo
2012-07-11 12:31     ` Josef Bacik [this message]
2012-07-11 13:04       ` Liu Bo
2012-07-11 17:21 ` Josef Bacik
2012-07-12  1:14   ` Liu Bo

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=20120711123147.GH7529@localhost.localdomain \
    --to=jbacik@fusionio.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=liubo2009@cn.fujitsu.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;
as well as URLs for NNTP newsgroup(s).