From: "H. Peter Anvin" <hpa@zytor.com>
To: Christoph Lameter <cl@linux.com>
Cc: Tejun Heo <tj@kernel.org>,
akpm@linux-foundation.org, Pekka Enberg <penberg@cs.helsinki.fi>,
linux-kernel@vger.kernel.org,
Eric Dumazet <eric.dumazet@gmail.com>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Subject: Re: [cpuops cmpxchg double V1 1/4] Generic support for this_cpu_cmpxchg_double
Date: Thu, 23 Dec 2010 16:22:45 -0800 [thread overview]
Message-ID: <4D13E7D5.7020503@zytor.com> (raw)
In-Reply-To: <alpine.DEB.2.00.1012231812280.22549@router.home>
On 12/23/2010 04:16 PM, Christoph Lameter wrote:
> On Wed, 22 Dec 2010, Tejun Heo wrote:
>
>>> I'm a bit confused on this one. The standard cmpxchg() takes a scalar
>>> and a pointer, and returns a scalar. The equivalent for the "double"
>>> variety would be to return a compound object, basically:
>>>
>>> struct double_ulong {
>>> unsigned long v[2];
>>> };
>>>
>>> ... which can be returned in registers on both i386 and x86-64.
>
> Really? How would that work? I tried with uint128 but could not get the
> compiler to do the right thing.
>
There are two return registers; two machine registers can be returned in
registers. [u]int128 is poorly implemented in a lot of gcc versions,
since it really hasn't been exercised. However, two-word structures
should work. I do not believe a two-word *array* works, though.
>>> It's a bit clumsy from a type perspective, but I'm not sure that that is
>>> a bad thing. Doing too much type genericity has caused us problems in
>>> the past.
>>
>> Yeah, the above might be better too. Is there any reason to use
>> cmpxchg_double on anything smaller?
>
> Yes. You may want to use cmpxchg_double on 32 bit entities for backwards
> compatibilities sake or any other smaller unit size. But those could also
> be realized using this_cpu_cmpxchg_<double the size> by just aggregating
> the amount.
>
> If we can indeed pass 128 bit entities (as claimed by hpa) via registers
> then the logical choice would be to do
>
> this_cpu_cmpxchg_16(pcp, old, new)
>
> instead of cmpxchg_double. All parameters would have to be bit.
> Then we can avoid the strange cmpxchg_double semantics and can completely
> avoid introducing those.
I'm not sure it works with passing in a structure.
-hpa
next prev parent reply other threads:[~2010-12-24 0:24 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-14 17:48 [cpuops cmpxchg double V1 0/4] this_cpu_cmpxchg_double support Christoph Lameter
2010-12-14 17:48 ` [cpuops cmpxchg double V1 1/4] Generic support for this_cpu_cmpxchg_double Christoph Lameter
2010-12-18 14:47 ` Tejun Heo
2010-12-18 14:51 ` Tejun Heo
2010-12-21 22:36 ` Christoph Lameter
2010-12-21 23:24 ` H. Peter Anvin
2010-12-22 9:14 ` Tejun Heo
2010-12-24 0:16 ` Christoph Lameter
2010-12-24 0:22 ` H. Peter Anvin [this message]
2010-12-25 4:53 ` Christoph Lameter
2010-12-25 6:11 ` H. Peter Anvin
2010-12-25 16:52 ` Tejun Heo
2010-12-25 23:55 ` Christoph Lameter
2010-12-27 10:52 ` Tejun Heo
2011-01-03 22:43 ` Christoph Lameter
2010-12-14 17:48 ` [cpuops cmpxchg double V1 2/4] x86: this_cpu_cmpxchg_double() support Christoph Lameter
2010-12-15 0:46 ` H. Peter Anvin
2010-12-15 0:56 ` H. Peter Anvin
2010-12-15 16:12 ` Christoph Lameter
2010-12-15 16:20 ` Christoph Lameter
2010-12-15 17:36 ` H. Peter Anvin
2010-12-15 17:53 ` Christoph Lameter
2010-12-15 16:32 ` H. Peter Anvin
2010-12-15 16:41 ` Christoph Lameter
2010-12-14 17:48 ` [cpuops cmpxchg double V1 3/4] slub: Get rid of slab_free_hook_irq() Christoph Lameter
2010-12-14 17:48 ` [cpuops cmpxchg double V1 4/4] Lockless (and preemptless) fastpaths for slub Christoph Lameter
2010-12-15 16:51 ` Tejun Heo
2010-12-15 16:55 ` Pekka Enberg
2010-12-15 16:57 ` Tejun Heo
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=4D13E7D5.7020503@zytor.com \
--to=hpa@zytor.com \
--cc=akpm@linux-foundation.org \
--cc=cl@linux.com \
--cc=eric.dumazet@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=penberg@cs.helsinki.fi \
--cc=tj@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
Powered by JetHome