From: Nikolay Borisov <nborisov@suse.com>
To: dsterba@suse.cz, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs: Relax memory barrier in btrfs_tree_unlock
Date: Sat, 24 Feb 2018 12:59:36 +0200 [thread overview]
Message-ID: <c5867a7f-bb9d-adfc-829c-2045f8880765@suse.com> (raw)
In-Reply-To: <20180224001420.GU1469@twin.jikos.cz>
On 24.02.2018 02:14, David Sterba wrote:
> On Wed, Feb 14, 2018 at 02:37:26PM +0200, Nikolay Borisov wrote:
>> When performing an unlock on an extent buffer we'd like to order the
>> decrement of extent_buffer::blocking_writers with waking up any
>> waiters. In such situations it's sufficient to use smp_mb__after_atomic
>> rather than the heavy smp_mb. On architectures where atomic operations
>> are fully ordered (such as x86 or s390) unconditionally executing
>> a heavyweight smp_mb instruction causes a severe hit to performance
>> while bringin no improvements in terms of correctness.
>
> Have you measured this severe performance hit? There is an impact, but I
> doubt you'll ever notice it in the profiles given where the
> btrfs_tree_unlock appears.
Admittedly I haven't :) But I'd say "every little bit helps"
>
>> The better thing is to use the appropriate smp_mb__after_atomic routine
>> which will do the correct thing (invoke a full smp_mb or in the case
>> of ordered atomics insert a compiler barrier). Put another way,
>> an RMW atomic op + smp_load__after_atomic equals, in terms of
>> semantics, to a full smp_mb. This ensures that none of the problems
>> described in the accompanying comment of waitqueue_active occur.
>> No functional changes.
>
> I tend to agree.
>
next prev parent reply other threads:[~2018-02-24 10:59 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-14 12:37 [PATCH] btrfs: Relax memory barrier in btrfs_tree_unlock Nikolay Borisov
2018-02-24 0:14 ` David Sterba
2018-02-24 10:59 ` Nikolay Borisov [this message]
2018-03-07 16:05 ` David Sterba
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=c5867a7f-bb9d-adfc-829c-2045f8880765@suse.com \
--to=nborisov@suse.com \
--cc=dsterba@suse.cz \
--cc=linux-btrfs@vger.kernel.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).