From: Waiman Long <waiman.long@hp.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Will Deacon <will.deacon@arm.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] lockref: use cmpxchg64 explicitly for lockless updates
Date: Thu, 19 Sep 2013 22:59:10 -0400 [thread overview]
Message-ID: <523BB9FE.2030003@hp.com> (raw)
In-Reply-To: <CA+55aFxuc3yD5pH2w5uEr_VDsEANvEiGCWA6tu1cSFrAiaU4Ow@mail.gmail.com>
On 09/19/2013 02:11 PM, Linus Torvalds wrote:
> On Thu, Sep 19, 2013 at 1:06 PM, Will Deacon<will.deacon@arm.com> wrote:
>> The cmpxchg() function tends not to support 64-bit arguments on 32-bit
>> architectures. This could be either due to use of unsigned long arguments
>> (like on ARM) or lack of instruction support (cmpxchgq on x86). However,
>> these architectures may implement a specific cmpxchg64() function to
>> provide 64-bit cmpxchg support instead
> I'm certainly ok with this, but I wonder how much point there is to
> use the cmpxchg alternatives for 32-bit architectures at all...
>
> From a performance standpoint, lockref really is expected to mainly
> help with big machines. Only insane people would do big machines with
> 32-bit kernels these days.
> Of course, it may be that cmpxchg is actually faster on some
> architectures, but at least on x86-32, cmpxchg8b is traditionally
> quite slow.
>
> In other words, I'd actually like to see some numbers if there are
> loads where this actually helps and matters...
>
> Linus
I agreed that 32-bit machines are not likely to be big enough to get
benefit from this feature. However, I do see a minor problem with the
current code. If a user tries to turn on CMPXCHG_LOCKREF on a 32-bit
build, he/she will get a compilation error because a 64-bit data type is
not supported in 32-bit mode's cmpxchg(). Because of this, my original
patch also uses cmpxchg64() which is equivalent to cmpxchg() in 64-bit
machine for 64-bit data type.
I would suggest either change to use cmpxchg64() or add the dependence
line "depends on 64BIT" to CMPXCHG_LOCKREF.
-Longman
next prev parent reply other threads:[~2013-09-20 2:59 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-19 18:06 [PATCH] lockref: use cmpxchg64 explicitly for lockless updates Will Deacon
2013-09-19 18:11 ` Linus Torvalds
2013-09-20 2:59 ` Waiman Long [this message]
2013-09-20 10:08 ` Will Deacon
2013-09-20 15:45 ` Will Deacon
2013-09-20 16:00 ` Linus Torvalds
2013-09-20 17:11 ` Will Deacon
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=523BB9FE.2030003@hp.com \
--to=waiman.long@hp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=will.deacon@arm.com \
/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).