From: Linus Torvalds <torvalds@osdl.org>
To: Nick Piggin <npiggin@suse.de>
Cc: Andrew Morton <akpm@osdl.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [patch 1/2] atomic_add_unless sadness
Date: Wed, 18 Jan 2006 08:48:01 -0800 (PST) [thread overview]
Message-ID: <Pine.LNX.4.64.0601180842440.3240@g5.osdl.org> (raw)
In-Reply-To: <20060118063636.GA14608@wotan.suse.de>
On Wed, 18 Jan 2006, Nick Piggin wrote:
>
> For some reason gcc 4 on at least i386 and ppc64 (that I have tested with)
> emit two cmpxchges for atomic_add_unless unless we put branch hints in.
> (it is unlikely for the "unless" case to trigger, and it is unlikely for
> cmpxchg to fail).
Irrelevant. If "atomic_add_unless()" is in a hot path and inlined, we're
doing something else wrong anyway. It's not a good op to use. Just think
of it as being very expensive.
The _only_ user of "atomic_add_unless()" is "dec_and_lock()", which isn't
even inlined. The fact that gcc ends up "unrolling" the loop once is just
fine.
Please keep it that way.
Linus
next prev parent reply other threads:[~2006-01-18 16:48 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-01-18 6:36 Nick Piggin
2006-01-18 6:39 ` [patch 2/2] powerpc: native atomic_add_unless Nick Piggin
2006-01-18 17:11 ` Joel Schopp
2006-01-18 17:28 ` Nick Piggin
2006-01-18 21:05 ` Joel Schopp
2006-01-19 14:04 ` Nick Piggin
2006-01-18 16:48 ` Linus Torvalds [this message]
2006-01-18 17:10 ` [patch 1/2] atomic_add_unless sadness Nick Piggin
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=Pine.LNX.4.64.0601180842440.3240@g5.osdl.org \
--to=torvalds@osdl.org \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=npiggin@suse.de \
/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
all inboxes | Powered by JetHome®