linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Dave Chinner <david@fromorbit.com>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	linux-mm@kvack.org, khlebnikov@openvz.org
Subject: Re: [PATCH 13/13] dcache: convert to use new lru list infrastructure
Date: Wed, 24 Aug 2011 02:32:58 -0400	[thread overview]
Message-ID: <20110824063258.GE24077@infradead.org> (raw)
In-Reply-To: <1314089786-20535-14-git-send-email-david@fromorbit.com>

> +	struct list_head *freeable = arg;
> +	struct dentry	*dentry = container_of(item, struct dentry, d_lru);
> +
> +
> +	/*

double empty line.

> +	 * we are inverting the lru lock/dentry->d_lock here,
> +	 * so use a trylock. If we fail to get the lock, just skip
> +	 * it
> +	 */
> +	if (!spin_trylock(&dentry->d_lock))
> +		return 2;
> +
> +	/*
> +	 * Referenced dentries are still in use. If they have active
> +	 * counts, just remove them from the LRU. Otherwise give them
> +	 * another pass through the LRU.
> +	 */
> +	if (dentry->d_count) {
> +		list_del_init(&dentry->d_lru);
> +		spin_unlock(&dentry->d_lock);
> +		return 0;
> +	}
> +
> +	if (dentry->d_flags & DCACHE_REFERENCED) {

The comment aove seems odd, given that it doesn't match the code.
I'd rather have something like:

	/*
	 * Used dentry, remove it from the LRU.
	 */

in its place, and a second one above the DCACHE_REFERENCED check:

	/*
	 * Referenced dentry, give it another pass through the LRU.
	 */

> +		dentry->d_flags &= ~DCACHE_REFERENCED;
> +		spin_unlock(&dentry->d_lock);
> +
> +		/*
> +		 * XXX: this list move should be be done under d_lock. Need to
> +		 * determine if it is safe just to do it under the lru lock.
> +		 */
> +		return 1;
> +	}
> +
> +	list_move_tail(&dentry->d_lru, freeable);

Another odd comment.  It talks about doing a list_move in the branch
that doesn't do the list_move, and the list_move outside the branch
actually has the d_lock, thus disagreeing with the comment.

> +	this_cpu_dec(nr_dentry_unused);
> +	spin_unlock(&dentry->d_lock);

No need to decrement the per-cpu counter while still having the lock
held.

> @@ -1094,11 +1069,10 @@ resume:
>  		/*
>  		 * move only zero ref count dentries to the dispose list.
>  		 */
> +		dentry_lru_del(dentry);
>  		if (!dentry->d_count) {
> -			dentry_lru_move_list(dentry, dispose);
> +			list_add_tail(&dentry->d_lru, dispose);
>  			found++;
> -		} else {
> -			dentry_lru_del(dentry);

I'd rather move this hunk to the previous patch, as it fits into the
logical change done there.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

      reply	other threads:[~2011-08-24  6:32 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-23  8:56 [PATCH 00/12] RFC: shrinker APi rework and generic LRU lists Dave Chinner
2011-08-23  8:56 ` [PATCH 01/13] fs: Use a common define for inode slab caches Dave Chinner
2011-08-23  9:13   ` Christoph Hellwig
2011-08-23  9:20     ` Dave Chinner
2011-08-24  6:16       ` Christoph Hellwig
2011-08-23  8:56 ` [PATCH 02/13] dcache: convert dentry_stat.nr_unused to per-cpu counters Dave Chinner
2011-08-23  9:13   ` Christoph Hellwig
2011-08-24 14:12   ` Christoph Lameter
2011-08-23  8:56 ` [PATCH 03/13] dentry: move to per-sb LRU locks Dave Chinner
2011-08-24  6:16   ` Christoph Hellwig
2011-08-23  8:56 ` [PATCH 04/13] mm: new shrinker API Dave Chinner
2011-08-23  9:15   ` Christoph Hellwig
2011-08-23  9:23     ` Dave Chinner
2011-08-24  6:17       ` Christoph Hellwig
2011-08-23  8:56 ` [PATCH 05/13] mm: convert shrinkers to use new API Dave Chinner
2011-08-23  9:17   ` Christoph Hellwig
2011-08-23  9:35   ` Steven Whitehouse
2011-08-26 17:09   ` Wanlong Gao
2011-08-23  8:56 ` [PATCH 06/13] shrinker: remove old API now it is unused Dave Chinner
2011-08-23  8:56 ` [PATCH 07/13] Use atomic-long operations instead of looping around cmpxchg() Dave Chinner
2011-08-23  8:56 ` [PATCH 08/13] list: add a new LRU list type Dave Chinner
2011-08-23  9:20   ` Christoph Hellwig
2011-08-23  9:32     ` Dave Chinner
2011-08-23  9:58       ` Konstantin Khlebnikov
2011-08-24 14:24         ` Christoph Lameter
2011-08-23  8:56 ` [PATCH 09/13] inode: convert inode lru list to generic lru list code Dave Chinner
2011-08-24  6:38   ` Christoph Hellwig
2011-08-23  8:56 ` [PATCH 10/13] xfs: convert buftarg LRU to generic code Dave Chinner
2011-08-24  6:27   ` Christoph Hellwig
2011-08-23  8:56 ` [PATCH 11/13] dcache: use a dispose list in select_parent Dave Chinner
2011-08-23  9:37   ` Christoph Hellwig
2011-09-05  9:42   ` Christoph Hellwig
2011-08-23  8:56 ` [PATCH 12/13] dcache: remove dentries from LRU before putting on dispose list Dave Chinner
2011-08-23  9:35   ` Christoph Hellwig
2011-08-23  9:57     ` Dave Chinner
2011-08-23  8:56 ` [PATCH 13/13] dcache: convert to use new lru list infrastructure Dave Chinner
2011-08-24  6:32   ` Christoph Hellwig [this message]

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=20110824063258.GE24077@infradead.org \
    --to=hch@infradead.org \
    --cc=david@fromorbit.com \
    --cc=khlebnikov@openvz.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.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;
as well as URLs for NNTP newsgroup(s).