From: Hannes Reinecke <hare@suse.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: jakub@redhat.com, parri.andrea@gmail.com, j.alglave@ucl.ac.uk,
ksummit-discuss@lists.linuxfoundation.org, peterz@infradead.org,
ramana.radhakrishnan@arm.com, luc.maranget@inria.fr
Subject: Re: [Ksummit-discuss] [TECH TOPIC] Memory model, using ISO C++11 atomic ops
Date: Tue, 26 Jul 2016 17:23:36 +0200 [thread overview]
Message-ID: <f7c305f7-939a-b66c-4d6b-333e41c23017@suse.com> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1607260909420.12362-100000@netrider.rowland.org>
On 07/26/2016 03:10 PM, Alan Stern wrote:
> On Tue, 26 Jul 2016, Hannes Reinecke wrote:
>
>> I have been playing around with RCUs and memory barriers quite a lot
>> recently, and found some really 'odd' use-cases in the kernel which
>> would benefit from improvements here.
>
> Could you post one or two examples? It would be interesting to see
> what they involve.
>
I have been working on a performance regression when calling
'dm_suspend/dm_resume' repeatedly for several (hundreds) devices.
That boiled down to the patch introducing srcu in the device mapper core
with commit 83d5e5b0af907 (dm: optimize use SRCU and RCU).
Looking at it the code they do things like:
set_bit(DMF_BLOCK_IO_FOR_SUSPEND, &md->flags);
if (map)
synchronize_srcu(&md->io_barrier);
where the srcu is used to ensure the code has left the critical
sections. However, if the memory pointed to by the srcu isn't actually
freed why we could easily drop the 'synchronize_srcu' call.
But that would require that
a) the set_bit() above is indeed atomic
and
b) there's no need to call 'synchronize_rcu' if you're not actually
freeing memory but rather fiddle pointers.
Both are somewhat shady areas where the documentation nor usage reveals
some obvious insights.
On another example I've been doing performance patches to the lpfc
driver (cf my talk at VAULT this year), where I've replaced most
spinlocks with atomics and bitops.
Which should work as well, only that it's still a bit unclear to me
if an when you need barriers in addition to atomic resp bitops.
And if you need barriers, which variant would be most appropriate?
The __before or the __after variant?
Also, what happens to bitops on bitfields longer than an unsigned long?
Are they still atomic?
Cheers,
Hannes
--
Dr. Hannes Reinecke zSeries & Storage
hare@suse.com +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
next prev parent reply other threads:[~2016-07-26 15:23 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-22 10:34 David Howells
2016-07-22 16:44 ` Paul E. McKenney
2016-07-25 17:14 ` Luis R. Rodriguez
2016-07-26 6:09 ` Hannes Reinecke
2016-07-26 13:10 ` Alan Stern
2016-07-26 13:35 ` Paul E. McKenney
2016-07-29 1:06 ` Steven Rostedt
2016-07-26 15:23 ` Hannes Reinecke [this message]
2016-07-26 22:40 ` Paul E. McKenney
2016-07-23 20:21 ` Benjamin Herrenschmidt
2016-07-26 15:11 ` David Woodhouse
2016-07-28 10:41 ` Will Deacon
2016-08-02 13:42 ` Peter Zijlstra
2016-08-03 8:49 ` Will Deacon
2016-07-26 15:20 ` David Howells
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=f7c305f7-939a-b66c-4d6b-333e41c23017@suse.com \
--to=hare@suse.com \
--cc=j.alglave@ucl.ac.uk \
--cc=jakub@redhat.com \
--cc=ksummit-discuss@lists.linuxfoundation.org \
--cc=luc.maranget@inria.fr \
--cc=parri.andrea@gmail.com \
--cc=peterz@infradead.org \
--cc=ramana.radhakrishnan@arm.com \
--cc=stern@rowland.harvard.edu \
/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