From: David Howells <dhowells@redhat.com>
To: linux@horizon.com
Cc: nickpiggin@yahoo.com.au, linux-arch@vger.kernel.org,
linux-arm-kernel@lists.arm.linux.org.uk,
linux-kernel@vger.kernel.org, torvalds@osdl.org
Subject: Re: [PATCH] WorkStruct: Implement generic UP cmpxchg() where an
Date: Tue, 12 Dec 2006 10:37:15 +0000 [thread overview]
Message-ID: <13639.1165919835@redhat.com> (raw)
In-Reply-To: <20061212032456.23036.qmail@science.horizon.com>
linux@horizon.com wrote:
> do {
> oldvalue = ll(addr)
> newvalue = ... oldvalue ...
> } while (!sc(addr, oldvalue, newvalue))
>
> Where sc() could be a cmpxchg. But, more importantly, if the
> architecture did implement LL/SC, it could be a "try plain SC; if
> that fails try CMPXCHG built out of LL/SC; if that fails, loop"
If sc() is implemented with cmpxchg(), then this is a very silly piece of
code. cmpxchg() returns the current value if it fails, rendering a repetition
of ll() pointless. In some circumstances, you should really do it by putting
the cmpxchg() up front with what you expect the most likely substitution to
be, and that then doesn't require the initial load.
David
next prev parent reply other threads:[~2006-12-12 10:37 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-12-11 2:30 [PATCH] WorkStruct: Implement generic UP cmpxchg() where an linux
2006-12-11 4:30 ` Nick Piggin
2006-12-11 6:17 ` linux
2006-12-11 7:36 ` Nick Piggin
2006-12-12 3:24 ` linux
2006-12-12 10:37 ` David Howells [this message]
2006-12-11 4:49 ` Linus Torvalds
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=13639.1165919835@redhat.com \
--to=dhowells@redhat.com \
--cc=linux-arch@vger.kernel.org \
--cc=linux-arm-kernel@lists.arm.linux.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@horizon.com \
--cc=nickpiggin@yahoo.com.au \
--cc=torvalds@osdl.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