mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Peter W. Morreale" <pmorreale@novell.com>
To: Andi Kleen <andi@firstfloor.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH 0/2] pdflush fix and enhancement
Date: Tue, 30 Dec 2008 21:11:04 -0700	[thread overview]
Message-ID: <1230696664.3470.105.camel@hermosa.site> (raw)
In-Reply-To: <20081231024609.GQ496@one.firstfloor.org>

On Wed, 2008-12-31 at 03:46 +0100, Andi Kleen wrote:
> On Tue, Dec 30, 2008 at 06:56:29PM -0700, Peter W. Morreale wrote:
> > The rational is simply because one-size may not fit all.  Currently
> > there is minimalistic tuning wrt pdflush thread creation. 
> 
> Thanks. Please put this into the commit description for future
> reference. 
> 

Will do.

> Some comments below.
> 
> > Each pdflush thread arbitrarily decides to create another thread solely
> > on the basis of all currently existing threads being busy for >= one
> > second.  So this can result in NCPUS pdflush threads being created
> > 'concurrently' should all existing threads wind up in the idle check at
> > the same time (I have seen this).  Or it can result in a thread being
> 
> So perhaps a simple lock serializing creation of new pdflush threads
> would avoid the problem?

nod.  It's probably even simpler than that.  By merely updating
'last_empty_jifs" when we decide to create the next pdflush thread, we
could easily account for _most_ of the races without adding significant
overhead.  

I say most because the assumption would be that we will be successful in
creating the new thread.  Not that bad an assumption I think.  Besides,
the consequences of a miss are not harmful. 
 
> 
> > More to the point, on small systems with few file systems, what is the
> > point of having 8 (the current max) threads competing with each other on
> > a single disk?  Likewise, on a 64-way, or larger system with dozens of
> > filesystems/disks, why wouldn't I want more background flushing?
> 
> That makes some sense, but perhaps it would be better to base the default
> size on the number of underlying block devices then?
> 
> Ok one issue there is that there are lots of different types of 
> block devices, e.g. a big raid array may look like a single disk.
> Still I suspect defaults based on the block devices would do reasonably
> well.

Could be...  However bear in mind that we traverse *filesystems*, not
block devs with background_writeout() (the pdflush work function). 

But even if we did block devices, consider that we still don't know the
speed of those devices (consider SSD v. raid v. disk) and consequently,
we don't know how many threads to throw at the device before it becomes
congested and we're merely spinning our wheels.  I mean, an SSD at
500MB/s (or greater) certainly could handle more pages being thrown at
it than an IDE drive... 

And this ties back to MAX_WRITEBACK_PAGES (currently 1k) which is the
chunk that we write out in one pass.   In order to not "hold the inode
lock too long", this is the chunk we attempt to write out.  

What is the right magic number for the various types of block devs?  1k
for all?  for all time?  :-)

Anyway, back to the traversal of filesystems.  In writeback_inodes(), we
currently traverse the super block list in reverse.  I don't quite
understand why we do this, but <shrug>.  

What this does mean is that unfairly penalize certain file systems when
attempting to clean dirty pages.  If I have 5 filesystems, all getting
hit on, then the last one in will always be the 'cleanest'.   Not sure
that makes sense.  

I was thinking about a patch that would go both directions - forward and
reverse depending upon, say, a bit in jiffies...  Certainly not perfect,
but a bit more fair.  

Actually, it seems to me that we need to look at a radically different
approach.  What about making background writes a property of the super
block? (which implies the file system)  Has that been discussed before?


Best,
-PWM



> 
> > 
> > I actually think the question is: Why not allow the admin to control
> > this?  Since it seems like this is a matter of policy based on machine
> > configuration. 
> 
> The kernel should know the current machine config and most 
> admins don't really want to do very fine grained configuration;
> they expect the system to perform well out of the box. That is
> why it is adventageous to try to come up with good auto tuning.
> 
> > And btw Andi, I should have cc'ed you on this, I know from the flush
> > code that you were heavily involved.  I only cc'ed Peter Z. since his
> > name was in pdflush.c.  My apologies.  
> 
> No problem, but I think you're confusing me with someone else :). I don't
> remember ever hacking on this. Perhaps you thought of Andrew Morton
> who did pdflush originally.
> 
> -Andi
> 


  reply	other threads:[~2008-12-31  4:11 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-30 23:12 Peter W Morreale
2008-12-30 23:12 ` [PATCH 1/2] Fix pdflush thread creation upper bound Peter W Morreale
2008-12-30 23:12 ` [PATCH 2/2] Add /proc controls for pdflush threads Peter W Morreale
2008-12-30 23:59   ` Randy Dunlap
2008-12-31  0:15     ` Peter W. Morreale
2008-12-31  2:38     ` Peter W. Morreale
2008-12-31  3:30       ` Randy Dunlap
2008-12-31  8:01   ` Andrew Morton
2008-12-31 14:54     ` Peter W. Morreale
2008-12-31  0:28 ` [PATCH 0/2] pdflush fix and enhancement Andi Kleen
2008-12-31  1:56   ` Peter W. Morreale
2008-12-31  2:46     ` Andi Kleen
2008-12-31  4:11       ` Peter W. Morreale [this message]
2008-12-31  7:08         ` Dave Chinner
2008-12-31 15:40           ` Peter W. Morreale
2009-01-01 23:27             ` Dave Chinner
2009-01-02  2:07               ` Peter W. Morreale
2008-12-31 13:27         ` Andi Kleen
2008-12-31 16:08           ` Peter W. Morreale
2009-01-01  1:48             ` Andi Kleen
2008-12-31 11:40       ` Martin Knoblauch

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=1230696664.3470.105.camel@hermosa.site \
    --to=pmorreale@novell.com \
    --cc=andi@firstfloor.org \
    --cc=linux-kernel@vger.kernel.org \
    /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®