From: Peter Zijlstra <peterz@infradead.org>
To: Nick Piggin <npiggin@suse.de>
Cc: linux-arch@vger.kernel.org, linux-fsdevel@vger.kernel.org,
Ian Kent <raven@themaw.net>,
Linus Torvalds <torvalds@linux-foundation.org>,
linux-kernel@vger.kernel.org, David Miller <davem@davemloft.net>,
Al Viro <viro@ZenIV.linux.org.uk>
Subject: Re: [rfc][patch 4a/6] brlock: "fast" brlocks
Date: Thu, 15 Oct 2009 13:05:21 +0200 [thread overview]
Message-ID: <1255604722.8392.467.camel@twins> (raw)
In-Reply-To: <20091015065839.GA4262@wotan.suse.de>
On Thu, 2009-10-15 at 08:58 +0200, Nick Piggin wrote:
> [Not for merge. Stop reading if you're not interested in locking minutiae.]
>
> OK, this is untested but I think the theory is right. Basically it is taking
> the idea from Dave M's cool brlock optimisation stuff with one further
> optimisation in that the read locker does not check the spinlock but
> rather we keep another wlocked variable together inthe same cacheline per
> CPU, so the read locker only has to touch one cacheline rather than 2.
>
> This actually will reduce the number of atomics by 2 per path lookup,
> however we have an smp_mb() there now which is really nasty on some
> architectures (like ia64 and ppc64), and not that nice on x86 either.
> We can probably do something interesting on ia64 and ppc64 so that we
> take advantage of the fact rlocked and wlocked are in the same cacheline
> so cache coherency (rather than memory consistency) should always provide
> a strict ordering there. We still do need an acquire barrier -- but it is
> a much nicer lwsync or st.acq on ppc and ia64.
>
> But: is the avoidance of the atomic RMW a big win? On x86 cores I've tested
> IIRC mfence is about as costly as a locked instruction which includes the
> mfence...
>
> So long story short: it might be a small win but it is going to be very
> arch specific and will require arch specific code to do the barriers and
> things. The generic spinlock brlock isn't bad at all, so I'll just post
> this as a curiosity for the time being.
>
fwiw, I rather like this implementation better, and adding lockdep
annotations to this one shouldn't be hard.
next prev parent reply other threads:[~2009-10-15 11:06 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-15 4:40 [patch 0/6] vfsmount scaling and other bits npiggin
2009-10-15 4:40 ` [patch 1/6] fs: invalidate sb->s_bdev on remount,ro npiggin
2009-10-15 4:40 ` [patch 2/6] fs: no games with DCACHE_UNHASHED npiggin
2009-10-15 6:31 ` David Miller
2009-10-15 7:44 ` Eric Dumazet
2009-10-15 8:13 ` Nick Piggin
2009-10-15 8:29 ` Nick Piggin
2009-10-15 9:13 ` Eric Dumazet
2009-10-15 13:20 ` Matthew Wilcox
2009-10-15 14:41 ` Nick Piggin
2009-10-15 4:40 ` [patch 3/6] fs: dcache remove d_mounted npiggin
2009-10-15 10:37 ` Ian Kent
2009-10-15 4:40 ` [patch 4/6] brlock: introduce special brlocks npiggin
2009-10-15 6:58 ` [rfc][patch 4a/6] brlock: "fast" brlocks Nick Piggin
2009-10-15 11:05 ` Peter Zijlstra [this message]
2009-10-15 11:26 ` Nick Piggin
2009-10-19 5:25 ` [patch 4/6] brlock: introduce special brlocks Andrew Morton
2009-10-19 9:49 ` Nick Piggin
2009-10-19 12:24 ` Andrew Morton
2009-10-19 12:48 ` Nick Piggin
2009-10-15 4:40 ` [patch 5/6] fs: brlock vfsmount_lock npiggin
2009-10-15 4:40 ` [patch 6/6] fs: scale mntget/mntput npiggin
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=1255604722.8392.467.camel@twins \
--to=peterz@infradead.org \
--cc=davem@davemloft.net \
--cc=linux-arch@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=npiggin@suse.de \
--cc=raven@themaw.net \
--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).