[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <561448323.948.1570120298211.JavaMail.zimbra@efficios.com>
Date: Thu, 3 Oct 2019 12:31:38 -0400 (EDT)
From: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
To: rostedt <rostedt@...dmis.org>
Cc: David Howells <dhowells@...hat.com>, paulmck@...nel.org,
rcu <rcu@...r.kernel.org>,
linux-kernel <linux-kernel@...r.kernel.org>,
Ingo Molnar <mingo@...nel.org>,
Lai Jiangshan <jiangshanlai@...il.com>,
dipankar <dipankar@...ibm.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Josh Triplett <josh@...htriplett.org>,
Thomas Gleixner <tglx@...utronix.de>,
Peter Zijlstra <peterz@...radead.org>,
Eric Dumazet <edumazet@...gle.com>,
fweisbec <fweisbec@...il.com>, Oleg Nesterov <oleg@...hat.com>,
"Joel Fernandes, Google" <joel@...lfernandes.org>,
Bart Van Assche <bart.vanassche@....com>,
Christoph Hellwig <hch@....de>, Hannes Reinecke <hare@...e.de>,
Johannes Thumshirn <jthumshirn@...e.de>,
Shane M Seymour <shane.seymour@....com>,
"Martin K . Petersen" <martin.petersen@...cle.com>
Subject: Re: [PATCH tip/core/rcu 1/9] rcu: Upgrade rcu_swap_protected() to
rcu_replace()
----- On Oct 3, 2019, at 9:08 AM, rostedt rostedt@...dmis.org wrote:
> On Thu, 03 Oct 2019 09:39:17 +0100
> David Howells <dhowells@...hat.com> wrote:
>
>> paulmck@...nel.org wrote:
>>
>> > +#define rcu_replace(rcu_ptr, ptr, c) \
>> > +({ \
>> > + typeof(ptr) __tmp = rcu_dereference_protected((rcu_ptr), (c)); \
>> > + rcu_assign_pointer((rcu_ptr), (ptr)); \
>> > + __tmp; \
>> > +})
>>
>> Does it make sense to actually use xchg() if that's supported by the arch?
>>
>
> Hmm, is there really any arch that doesn't support xchg()? It would be
> very hard to do any kind of atomic operations without it.
>
> cmpxchg() is the one that I understand is optional by the arch.
I remember going through all kernel arch headers myself and introduce
irq-off-based xchg and cmpxchg generic implementations for all UP
architectures lacking cmpxchg/xchg instructions.
We might want to consider simply using xchg() here.
FWIW, the API exposed by the Userspace RCU project (liburcu) for this
is:
rcu_xchg_pointer()
Thanks,
Mathieu
--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
Powered by blists - more mailing lists