From: torvalds@transmeta.com (Linus Torvalds)
To: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] move xchg/cmpxchg to atomic.h
Date: 2 Jan 2001 11:51:23 -0800 [thread overview]
Message-ID: <92tbfr$okp$1@penguin.transmeta.com> (raw)
In-Reply-To: <20010102125924.A9538@gruyere.muc.suse.de> <E14DV5K-0002Xn-00@the-village.bc.nu>
In article <E14DV5K-0002Xn-00@the-village.bc.nu>,
Alan Cox <alan@lxorguk.ukuu.org.uk> wrote:
>> > We really can't. We _only_ have load-and-zero. And it has to be 16-byte
>> > aligned. xchg() is just not something the CPU implements.
>>
>> The network code relies on the reader-xchg semantics David described in
>> several places.
>
>I guess the network code will just have to change for 2.5. read_xchg_val()
>can be a null macro for everyone else at least
You can easily do reader-xchg semantics even if you don't have an atomic
xchg and are using spinlocks. In fact, it will work the obvious way
correctly, assuming that the reader either gets the old value or the new
value but not some "partway old and new".
A xchg() that uses spinlocks and a simple read+write inside the spinlock
will give that exact behaviour as long as the "load-and-zero" is not
used for the xchg _value_, but only used for the spinlock, which is the
obvious implementation.
So we're fine. The parisc implementation isn't the fastest in the world,
but hey, that's what you get for having bad hardware support for SMP.
Linus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
next prev parent reply other threads:[~2001-01-02 20:22 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-01-02 8:11 [PATCH] move xchg/cmpxchg to atomic.h Grant Grundler
2001-01-02 9:03 ` David S. Miller
2001-01-02 11:22 ` Matthew Wilcox
2001-01-02 11:21 ` David S. Miller
2001-01-02 20:44 ` Roman Zippel
2001-01-02 22:05 ` Daniel Phillips
2001-01-02 11:59 ` Andi Kleen
2001-01-02 17:18 ` Alan Cox
2001-01-02 19:51 ` Linus Torvalds [this message]
2001-01-02 20:39 ` Grant Grundler
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='92tbfr$okp$1@penguin.transmeta.com' \
--to=torvalds@transmeta.com \
--cc=linux-kernel@vger.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