From: Nick Piggin <nickpiggin@yahoo.com.au>
To: David Howells <dhowells@redhat.com>
Cc: torvalds@osdl.org, akpm@osdl.org, steved@redhat.com,
trond.myklebust@fys.uio.no, aviro@redhat.com,
linux-fsdevel@vger.kernel.org, linux-cachefs@redhat.com,
nfsv4@linux-nfs.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 6/6] Optimise d_find_alias() [try #6]
Date: Wed, 08 Mar 2006 19:22:50 +1100 [thread overview]
Message-ID: <440E945A.1050404@yahoo.com.au> (raw)
In-Reply-To: <25795.1141737864@warthog.cambridge.redhat.com>
David Howells wrote:
> Nick Piggin <nickpiggin@yahoo.com.au> wrote:
>
>
>>Having the smp_rmb() here implies there is some sort of memory barrier
>>based synchronisation protocol at a higher level (than this function),
>>because you don't actually do anything before them smp_rmb() here.
>>
>>So can you comment what that is?
>
>
> Hmmm... That probably shouldn't be there. I don't think Andrew Morton and I
> actually came to an agreement as to whether it's necessary. I don't think it
> is, he thought that it was, though he may have changed his mind.
>
I think this is easy to argue that the optimisation is OK _if_ the condition
being moved outside the locks is atomic.
The reasoning: if there is _no_ higher synchronisation which guarantees the
condition may be flipped one way or the other, then it is equally uncertain
of whether the spinlock will be taken before or after any critical sections
that modify the value. If there _is_ some higher synchronisation, then the
value is going to be correct anyway -- *unless* you are using some consistency
based lockless synchronisation (ie. if this value is 10 then that must be
false), which is what an rmb could be covering.
Now in this case, the condition isn't exactly atomic but I think that's still
OK, because it shouldn't be able to get a false negative or positive during
some transient operation (ie. if the list was _never_ empty within our known
synchronisation, it will return false, if it was _always_ empty, true).
So I guess the only question is whether some code relies on another value to
"know" the result ( if (inode->nr_aliases > 0) {d_find_alias(inode);} ), in
which case I _think_ an rmb there can get you out of trouble. But you'd need
a comment.
Also: I might be talking complete crap here, so anyone feel free to ridicule
me if I'm wrong.
--
SUSE Labs, Novell Inc.
Send instant messages to your online friends http://au.messenger.yahoo.com
next prev parent reply other threads:[~2006-03-08 8:22 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-07 11:33 [PATCH 1/6] NFS: Permit filesystem to override root dentry on mount [try #6] David Howells
2006-03-07 11:33 ` [PATCH 2/6] 9p: Fix error handling on superblock alloc failure " David Howells
2006-03-07 11:33 ` [PATCH 3/6] NFS: Abstract out namespace initialisation " David Howells
2006-03-07 11:52 ` Christoph Hellwig
2006-03-07 11:33 ` [PATCH 4/6] NFS: Add dentry materialisation op " David Howells
2006-03-07 11:34 ` [PATCH 5/6] NFS: Unify NFS superblocks per-protocol per-server " David Howells
2006-03-07 11:34 ` [PATCH 6/6] Optimise d_find_alias() " David Howells
2006-03-07 12:03 ` Nick Piggin
2006-03-07 13:24 ` David Howells
2006-03-08 8:22 ` Nick Piggin [this message]
2006-03-08 12:14 ` Matthew Wilcox
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=440E945A.1050404@yahoo.com.au \
--to=nickpiggin@yahoo.com.au \
--cc=akpm@osdl.org \
--cc=aviro@redhat.com \
--cc=dhowells@redhat.com \
--cc=linux-cachefs@redhat.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nfsv4@linux-nfs.org \
--cc=steved@redhat.com \
--cc=torvalds@osdl.org \
--cc=trond.myklebust@fys.uio.no \
/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