linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Matthew Wilcox <matthew@wil.cx>
Cc: linux-fsdevel@vger.kernel.org
Subject: Re: [RFC] Remove BKL from fs/locks.c
Date: Sun, 30 Dec 2007 13:05:10 +0000	[thread overview]
Message-ID: <20071230130510.GA24756@infradead.org> (raw)
In-Reply-To: <20071230061615.GS11638@parisc-linux.org>

On Sat, Dec 29, 2007 at 11:16:15PM -0700, Matthew Wilcox wrote:

> It seems to work well enough, but I haven't run any serious stress  
> tests on it.  This implementation uses one spinlock to protect both lock
> lists and all the i_flock chains.  It doesn't seem worth splitting up
> the locking any further.

If people are really having any kind of scalability problems with this
still it should be quite trivial to make the file_lock_list and
blocked_list aswel as the new file_lock_lock per-superblock as file
and thus locks never move between superblocks.  In fact I'd probably
do this even without scalability concerns just to make our fs data
structures nice per-superblock.

> I had to move one memory allocation out from under the file_lock_lock.
> I hope I got that logic right.  I'm rather tempted to split out the
> find_conflict algorithm from that function into something that can be
> called separately for the FL_ACCESS case.

Yes, splitting that out makes a lot of sense.  Should be a separate
patch, though.


> +static inline void lock_flocks(void)
> +{
> +	spin_lock(&file_lock_lock);
> +}
> +
> +static inline void unlock_flocks(void)
> +{
> +	spin_unlock(&file_lock_lock);
> +}

I'd rather not introduce this wrappers, they only obsfucated what's
really going on.

> +	if (found) {
> +		unlock_flocks();
>  		cond_resched();
> +		lock_flocks();
> +	}

There's a cond_resched_lock that only drops the lock in case we really
need to block.


  parent reply	other threads:[~2007-12-30 13:05 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-30  6:16 [RFC] Remove BKL from fs/locks.c Matthew Wilcox
2007-12-30  9:36 ` Stephen Rothwell
2007-12-30 14:42   ` Matthew Wilcox
2007-12-31  0:47     ` Stephen Rothwell
2007-12-30 13:05 ` Christoph Hellwig [this message]
2007-12-30 14:51   ` Matthew Wilcox
2007-12-30 15:17     ` Andi Kleen
2007-12-30 18:44       ` Trond Myklebust
2007-12-30 19:18         ` Andi Kleen
2007-12-30 19:23           ` Trond Myklebust
2008-01-04 23:41 ` J. Bruce Fields

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=20071230130510.GA24756@infradead.org \
    --to=hch@infradead.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=matthew@wil.cx \
    /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).