mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Martin Schwidefsky <schwidefsky@de.ibm.com>
To: hugh@veritas.com
Cc: zippel@linux-m68k.org, zam@namesys.com, pj@sgi.com,
	wli@holomorphy.com, reiser@namesys.com,
	linux-kernel@vger.kernel.org, akpm@osdl.org
Subject: Re: 2.6.9-rc1-mm4 sparc reiser4 build broken - undefined    atomic_sub_and_test
Date: Mon, 13 Sep 2004 19:14:35 +0200	[thread overview]
Message-ID: <20040913171435.GA3566@mschwid3.boeblingen.de.ibm.com> (raw)

> > > But Bill already said he doesn't want it, [...]
> > > 
> > > -		 		 if (atomic_sub_and_test(bio->bi_vcnt, &fq->nr_submitted))
> > > +		 		 if (atomic_sub_return(bio->bi_vcnt, &fq->nr_submitted) == 0)
> > 
> > And that is more portable how?
> 
> It's more portable in that all but s390 already provide it
> (and I expect Martin will be happy to add it).

Well, adding the missing s390 atomic operations is easy (see patch).
But I really doubt that it will make a measurable difference in
performance on ANY architecture. You could do this with a
(atomic_add_return(-x, &v) == 0) ...

blue skies,
  Martin.

---

From: Martin Schwidefsky <schwidefsky@de.ibm.com>

Add atomic[64]_add_and_test, atomic[64]_sub_return and
atomic[64]_sub_and_test primitives.

Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>

diffstat:
 include/asm-s390/atomic.h |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+)

diff -urN linux-2.6/include/asm-s390/atomic.h linux-2.6-s390/include/asm-s390/atomic.h
--- linux-2.6/include/asm-s390/atomic.h	2004-08-14 12:54:48.000000000 +0200
+++ linux-2.6-s390/include/asm-s390/atomic.h	2004-09-13 19:04:13.000000000 +0200
@@ -53,6 +53,10 @@
 {
 	return __CS_LOOP(v, i, "ar");
 }
+static __inline__ int atomic_add_and_test(int i, atomic_t * v)
+{
+	return __CS_LOOP(v, i, "ar") == 0;
+}
 static __inline__ int atomic_add_negative(int i, atomic_t * v)
 {
 	return __CS_LOOP(v, i, "ar") < 0;
@@ -61,6 +65,14 @@
 {
 	       __CS_LOOP(v, i, "sr");
 }
+static __inline__ int atomic_sub_return(int i, atomic_t * v)
+{
+	return __CS_LOOP(v, i, "sr");
+}
+static __inline__ int atomic_sub_and_test(int i, atomic_t * v)
+{
+	return __CS_LOOP(v, i, "sr") == 0;
+}
 static __inline__ void atomic_inc(volatile atomic_t * v)
 {
 	       __CS_LOOP(v, 1, "ar");
@@ -127,6 +139,10 @@
 {
 	return __CSG_LOOP(v, i, "agr");
 }
+static __inline__ long long atomic64_add_and_test(int i, atomic64_t * v)
+{
+	return __CSG_LOOP(v, i, "agr") == 0;
+}
 static __inline__ long long atomic64_add_negative(int i, atomic64_t * v)
 {
 	return __CSG_LOOP(v, i, "agr") < 0;
@@ -135,6 +151,14 @@
 {
 	       __CSG_LOOP(v, i, "sgr");
 }
+static __inline__ long long atomic64_sub_return(int i, atomic64_t * v)
+{
+	return __CSG_LOOP(v, i, "sgr");
+}
+static __inline__ long long atomic64_sub_and_test(int i, atomic64_t * v)
+{
+	return __CSG_LOOP(v, i, "agr") == 0;
+}
 static __inline__ void atomic64_inc(volatile atomic64_t * v)
 {
 	       __CSG_LOOP(v, 1, "agr");

             reply	other threads:[~2004-09-13 17:15 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-13 17:14 Martin Schwidefsky [this message]
2004-09-13 17:26 ` Roman Zippel
     [not found] <OF6D4E73AE.1DB1AD2F-ON42256F0F.003132FF-42256F0F.00321365@de.ibm.com>
2004-09-14  9:40 ` Roman Zippel
  -- strict thread matches above, loose matches on Subject: below --
2004-09-12 10:12 Paul Jackson
2004-09-12 10:54 ` William Lee Irwin III
2004-09-12 16:33 ` Alex Zarochentsev
2004-09-12 18:49   ` Paul Jackson
2004-09-12 19:48     ` Alex Zarochentsev
2004-09-13 12:42       ` Hugh Dickins
2004-09-13 13:25         ` Roman Zippel
2004-09-13 13:51           ` Hugh Dickins
2004-09-13 14:10             ` Roman Zippel
2004-09-13 14:58               ` Hugh Dickins
2004-09-13 16:03                 ` Roman Zippel
2004-09-13 16:20                   ` Hugh Dickins
2004-09-13 20:03                   ` Tonnerre
2004-09-13 20:18                     ` Roman Zippel
2004-09-13 17:19                 ` Alex Zarochentsev
2004-09-14  2:06                   ` William Lee Irwin III
2004-09-14  9:00                     ` Roman Zippel
2004-09-14  9:10                       ` William Lee Irwin III

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=20040913171435.GA3566@mschwid3.boeblingen.de.ibm.com \
    --to=schwidefsky@de.ibm.com \
    --cc=akpm@osdl.org \
    --cc=hugh@veritas.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pj@sgi.com \
    --cc=reiser@namesys.com \
    --cc=wli@holomorphy.com \
    --cc=zam@namesys.com \
    --cc=zippel@linux-m68k.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