linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nick Piggin <npiggin@kernel.dk>
To: Dave Chinner <david@fromorbit.com>
Cc: Nick Piggin <npiggin@kernel.dk>,
	linux-fsdevel@vger.kernel.org,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Al Viro <viro@ZenIV.linux.org.uk>, Christoph Hellwig <hch@lst.de>
Subject: Re: [patch] fs: use fast counters for vfs caches
Date: Thu, 9 Dec 2010 17:16:44 +1100	[thread overview]
Message-ID: <20101209061644.GA3667@amd> (raw)
In-Reply-To: <20101209054343.GA8259@dastard>

On Thu, Dec 09, 2010 at 04:43:43PM +1100, Dave Chinner wrote:
> On Mon, Nov 29, 2010 at 09:57:33PM +1100, Nick Piggin wrote:
> > Hey,
> > 
> > What was the reason behind not using my approach to use fast per-cpu
> > counters for inode and dentry counters, and instead using the
> > percpu_counter lib (which is not useful unless very fast approximate
> > access to the global counter is required, or performance is not
> > critical, which is somewhat of an oxymoron if you're using per-counters
> > in the first place). It is a difference between this:
> 
> Hi Nick - sorry for being slow to answer this - I only just found
> this email.
> 
> The reason for using the generic counters is because the shrinkers
> read the current value of the global counter on every call and hence
> they can be read thousands of times a second. The only way to do that
> efficiently is to use the approximately value the generic counters
> provide.

That is not what is happening, though, so I assume that no measurements
were done.

In fact what happens now is that *both* type of counters use the crappy
percpu counter library, and the shrinkers actually do a per-cpu loop
over the counters to get the sum.

But anyway even if that operation was fast, it is silly to use a per
cpu counter for nr_unused, because it is tied fundamentally to the LRU,
so you can't get any more scalability than the LRU operations anyway!

I'm all for breaking out patches and pulling things ahead where they
make sense, but it seems like things have just been done without much
thought or measurements or any critical discussion of why changes were
made.

There wasn't even any point making the total counter per-cpu yet either,
seeing as there is still a lot of global locking in there it would not
have made any difference to scalability, and only slowed things down.

What it _should_ look like is exactly what I had in my tree.  Proper,
fast total object counters with a per-cpu loop for the sum when the
global locks in the create/destroy path are lifted; with per-LRU counter
for nr_unused counter which is protected together with lru lock.


  reply	other threads:[~2010-12-09  6:16 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-29 10:57 [patch] fs: use fast counters for vfs caches Nick Piggin
2010-12-09  5:43 ` Dave Chinner
2010-12-09  6:16   ` Nick Piggin [this message]
2010-12-09  6:40     ` Nick Piggin
2010-12-10  4:51       ` [patch 1/2] fs: revert percpu nr_unused counters for dentry and inodes Nick Piggin
2010-12-10  4:55         ` [patch 2/2] fs: use fast counters for vfs caches Nick Piggin
2010-12-09  7:45     ` [PATCH] fs: use approximate counter values for inodes and dentries. (was Re: [patch] fs: use fast counters for vfs caches) Dave Chinner
2010-12-09 12:24       ` Nick Piggin
2010-12-09 23:30         ` Dave Chinner
2010-12-10  2:23           ` Nick Piggin

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=20101209061644.GA3667@amd \
    --to=npiggin@kernel.dk \
    --cc=david@fromorbit.com \
    --cc=hch@lst.de \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=torvalds@linux-foundation.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;
as well as URLs for NNTP newsgroup(s).