linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: David Chinner <dgc@sgi.com>
Cc: jblunck@suse.de, linux-kernel@vger.kernel.org,
	linux-fsdevel@vger.kernel.org, viro@zeniv.linux.org.uk,
	dgc@sgi.com, balbir@in.ibm.com
Subject: Re: [patch 0/5] [PATCH,RFC] vfs: per-superblock unused dentries list (2nd version)
Date: Thu, 1 Jun 2006 19:49:12 -0700	[thread overview]
Message-ID: <20060601194912.8173705a.akpm@osdl.org> (raw)
In-Reply-To: <20060602022339.GY7418631@melbourne.sgi.com>

On Fri, 2 Jun 2006 12:23:39 +1000
David Chinner <dgc@sgi.com> wrote:

> On Thu, Jun 01, 2006 at 06:06:59PM -0700, Andrew Morton wrote:
> > On Thu, 01 Jun 2006 11:51:25 +0200
> > jblunck@suse.de wrote:
> > 
> > > This is an attempt to have per-superblock unused dentry lists.
> > 
> > Fairly significant clashes with
> > ftp://ftp.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.17-rc5/2.6.17-rc5-mm2/broken-out/fix-dcache-race-during-umount.patch 
> > 
> > I guess Neil's patch will go into the 2.6.18 tree, so you'd be best off
> > working against that.
> 
> Though this patch series fixes the same problem in a much cleaner
> way. It effectively obsoletes Neil's fix.

OK.

> > Also, you're making what appears to be a quite deep design change to a
> > pretty important part of the memory reclaim code and all the info we have
> > is this:
> > 
> > 
> > +				/*
> > +				 * Try to be fair to the unused lists:
> > +				 *  sb_count/sb_unused ~ count/global_unused
> > +				 *
> > +				 * Additionally, if the age_limit of the
> > +				 * superblock is expired shrink at least one
> > +				 * dentry from the superblock
> > +				 */
> > +				tmp = sb->s_dentry_stat.nr_unused /
> > +					((unused / count) + 1);
> > +				if (!tmp && time_after(jiffies,
> > +						       sb->s_dentry_unused_age))
> > +					tmp = 1;
> > 
> > 
> > Please, we'll need much much more description of what this is trying to
> > achieve, why it exists, analysis, testing results, etc, etc.  Coz my
> > immediate reaction is "wtf is that, and what will that do to my computer?".
> 
> Discussed in this thread:
> 
> http://marc.theaimsgroup.com/?l=linux-fsdevel&m=114890371801114&w=2
> 
> Short summary of the problem: due to SHRINK_BATCH resolution, a proportional
> reclaim based on "count" across all superblocks will not shrink anything on
> lists 2 orders of magnitude smaller than the longest list as tmp will evaluate
> as zero.  Hence to prevent small unused lists from never being reclaimed and
> pinning memory until >90% of the dentry cache has been reclaimed we need to
> turn them over slowly. However, if we turn them over too quickly, the dentry
> cache does no caching for small filesystems.
> 
> This is not a problem a single global unused list has...

Reasonable.  Whatever we do needs to be fully communicated in the comment
text please.

> > In particular, `jiffies' has near-to-zero correlation with the rate of
> > creation and reclaim of these objects, so it looks highly inappropriate
> > that it's in there.  If anything can be used to measure "time" in this code
> > it is the number of scanned entries, not jiffies.
> 
> Sure, but SHRINK_BATCH resolution basically makes it impossible to reconcile
> lists of vastly different lengths. If the shrinker simply called us
> with the entire count it now hands us in batches, I doubt that this would be
> an issue.
> 
> In the mean time, we need some other method to ensure we do eventually free
> up these items on small lists. The above implements an idle timer used to
> determine when we start to turn over a small cache. Maybe if we wrap it in:
> 
> > +				if (!tmp && dentry_lru_idle(sb))
> > +					tmp = 1;
> 
> with a more appropriate comment it would make more sense?
> 
> Suggestions on other ways to resolve the problem are welcome....

Don't do a divide?

	sb->s_scan_count += count;
	...	
	tmp = sb->s_dentry_stat.nr_unused /
		(global_dentry_stat.nr_unused / sb->s_scan_count + 1);
	if (tmp) {
		sb->s_scan_count -= <can't be bothered doing the arith ;)>;
		prune_dcache_sb(sb, tmp);
	}

That could go weird on us if there are sudden swings in
sb->s_dentry_stat.nr_unused or global_dentry_stat.nr_unused, but
appropriate boundary checking should fix that?

  reply	other threads:[~2006-06-02  2:45 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-01  9:51 [patch 0/5] [PATCH,RFC] vfs: per-superblock unused dentries list (2nd version) jblunck
2006-06-01  9:51 ` [patch 1/5] vfs: remove whitespace noise from fs/dcache.c jblunck
2006-06-01  9:51 ` [patch 2/5] vfs: d_genocide() doesnt add dentries to unused list jblunck
2006-06-01  9:51 ` [patch 3/5] vfs: remove shrink_dcache_anon() jblunck
2006-06-01  9:51 ` [patch 4/5] vfs: per superblock dentry stats jblunck
2006-06-01  9:51 ` [patch 5/5] vfs: per superblock dentry unused list jblunck
2006-06-02  1:06 ` [patch 0/5] [PATCH,RFC] vfs: per-superblock unused dentries list (2nd version) Andrew Morton
2006-06-02  2:23   ` David Chinner
2006-06-02  2:49     ` Andrew Morton [this message]
2006-06-02  4:17       ` David Chinner
2006-06-02 15:33       ` Jan Blunck
2006-06-05  1:30 ` Neil Brown
2006-06-16 15:51   ` Jan Blunck
2006-06-16 22:25     ` Neil Brown
2006-06-18 23:56       ` David Chinner
2006-06-19  0:27         ` Neil Brown
2006-06-19  1:00           ` David Chinner
2006-06-19  1:21             ` Neil Brown
2006-06-19  2:04               ` Andrew Morton
2006-06-19  2:25                 ` Neil Brown
2006-06-19  5:55               ` David Chinner
2006-06-19  6:33                 ` Andrew Morton
2006-06-19  8:30                   ` David Chinner
2006-06-19 10:48                   ` Thomas Gleixner
2006-06-19 11:01                     ` Andrew Morton
2006-06-19 17:34                       ` Ravinandan Arakali
2006-06-20  0:37                         ` Andrew Morton
2006-06-20 21:34                           ` Ravinandan Arakali
2006-06-20 22:10                             ` Andrew Morton
2006-06-20 23:56                               ` Ravinandan Arakali
2006-06-21  0:18                                 ` Andrew Morton
2006-06-21  0:31                                   ` Ravinandan Arakali
2006-06-19  9:34       ` Jan Blunck

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=20060601194912.8173705a.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=balbir@in.ibm.com \
    --cc=dgc@sgi.com \
    --cc=jblunck@suse.de \
    --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;
as well as URLs for NNTP newsgroup(s).