linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: viro@ZenIV.linux.org.uk, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/4] fs: Lock the inode LRU list separately
Date: Thu, 28 Oct 2010 09:24:44 +1100	[thread overview]
Message-ID: <20101027222444.GC2715@dastard> (raw)
In-Reply-To: <20101027090530.GB16443@infradead.org>

On Wed, Oct 27, 2010 at 05:05:30AM -0400, Christoph Hellwig wrote:
> > @@ -537,15 +545,10 @@ void evict_inodes(struct super_block *sb)
> >  		}
> >  
> >  		inode->i_state |= I_FREEING;
> > -		if (!(inode->i_state & (I_DIRTY | I_SYNC)))
> > -			percpu_counter_dec(&nr_inodes_unused);
> > +		inode_lru_list_del(inode);
> >  		spin_unlock(&inode->i_lock);
> >  
> > -		/*
> > -		 * Move the inode off the IO lists and LRU once I_FREEING is
> > -		 * set so that it won't get moved back on there if it is dirty.
> > -		 */
> > -		list_move(&inode->i_lru, &dispose);
> > +		list_add(&inode->i_lru, &dispose);
> >  	}
> >  	spin_unlock(&inode_lock);
> >  
> > @@ -582,15 +585,10 @@ int invalidate_inodes(struct super_block *sb)
> >  		}
> >  
> >  		inode->i_state |= I_FREEING;
> > -		if (!(inode->i_state & (I_DIRTY | I_SYNC)))
> > -			percpu_counter_dec(&nr_inodes_unused);
> > +		inode_lru_list_del(inode);
> >  		spin_unlock(&inode->i_lock);
> 
> with this scheme we now decrement nr_inodes_unused twice - once in
> invalidate_inodes/evict_inodes and once in dispose_one_inode. 

That doesn't happen because the counter is only modified when
the inode is moved on/off the list and there are checks to avoid
removing an inode that is not on the list. Also, the inode is not
removed from the LRU in dispose_one_inode - it is always done when
the inode is marked I_FREEING while the i_lock is held before
calling dispose_one_inode().

Basically I wanted to remove the strange "inode is not on the LRU if
it is dirty or under writeback" accounting checks and make the
accounting symmetric with adding/removing the inodes from the LRU.
These are protected by list_empty() checks, so should always end up
with the correct accounting.

hence the only special case now is prune_icache() which already
holds the inode_lru_lock() so can't call the helper. Besides, we
don't need any checks there because we know the inode is on the LRU
already....

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

  reply	other threads:[~2010-10-27 22:24 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-27  4:23 fs: break out inode LRU operations from node_lock Dave Chinner
2010-10-27  4:23 ` [PATCH 1/4] fs: protect inode->i_state with inode->i_lock Dave Chinner
2010-10-27  7:07   ` Christian Stroetmann
2010-10-27  8:58   ` Christoph Hellwig
2010-10-27  4:23 ` [PATCH 2/4] fs: factor inode disposal Dave Chinner
2010-10-27  7:55   ` Christoph Hellwig
2010-10-27  9:06   ` Christoph Hellwig
2010-10-27  4:23 ` [PATCH 3/4] fs: Lock the inode LRU list separately Dave Chinner
2010-10-27  7:08   ` Christian Stroetmann
2010-10-27  9:05   ` Christoph Hellwig
2010-10-27 22:24     ` Dave Chinner [this message]
2010-10-28 10:25       ` Christoph Hellwig
2010-10-28 10:58         ` Dave Chinner
2010-10-27  4:23 ` [PATCH 4/4] fs: remove inode_lock from iput_final and prune_icache Dave Chinner
2010-10-27  4:40   ` Al Viro
2010-10-27  4:47     ` Eric Dumazet
2010-10-27  5:25       ` Al Viro
2010-10-27  5:50         ` Eric Dumazet
2010-10-27  6:01           ` Al Viro
2010-10-27  6:09           ` Davidlohr Bueso
2010-10-27  7:11           ` Christian Stroetmann
2010-10-27  9:12     ` Dave Chinner
  -- strict thread matches above, loose matches on Subject: below --
2010-10-27 23:02 fs: break out inode LRU operations from inode_lock V2 Dave Chinner
2010-10-27 23:02 ` [PATCH 3/4] fs: Lock the inode LRU list separately Dave Chinner

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=20101027222444.GC2715@dastard \
    --to=david@fromorbit.com \
    --cc=hch@infradead.org \
    --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).