public inbox for linux-arch@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: davidm@hpl.hp.com
Cc: davidm@napali.hpl.hp.com, ink@jurassic.park.msu.ru,
	linux-arch@vger.kernel.org
Subject: Re: atomic ops for a VM fix
Date: Thu, 13 May 2004 15:52:48 -0700	[thread overview]
Message-ID: <20040513155248.4534f833.akpm@osdl.org> (raw)
In-Reply-To: <16547.63434.35149.755394@napali.hpl.hp.com>

David Mosberger <davidm@napali.hpl.hp.com> wrote:
>
> >>>>> On Fri, 14 May 2004 01:52:22 +0400, Ivan Kokshaysky <ink@jurassic.park.msu.ru> said:
> 
>   Ivan> It seems atomic_inc_and_test() is missing on alpha.
> 
>   Ivan> +#define atomic_inc_and_test(v) (atomic_add_return(1, (v)) == 0)
> 
> And I seem to have gotten the ia64-version wrong (it tests for != 0).
> I'll fix that now.

Neato.


From: David Mosberger <davidm@napali.hpl.hp.com>


---

 25-akpm/include/asm-ia64/atomic.h |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

diff -puN include/asm-ia64/atomic.h~ia64-atomic_inc_and_test-fix include/asm-ia64/atomic.h
--- 25/include/asm-ia64/atomic.h~ia64-atomic_inc_and_test-fix	Thu May 13 15:49:32 2004
+++ 25-akpm/include/asm-ia64/atomic.h	Thu May 13 15:49:32 2004
@@ -159,7 +159,7 @@ atomic64_add_negative (__s64 i, atomic64
 
 #define atomic_sub_and_test(i,v)	(atomic_sub_return((i), (v)) == 0)
 #define atomic_dec_and_test(v)		(atomic_sub_return(1, (v)) == 0)
-#define atomic_inc_and_test(v)		(atomic_add_return(1, (v)) != 0)
+#define atomic_inc_and_test(v)		(atomic_add_return(1, (v)) == 0)
 #define atomic64_sub_and_test(i,v)	(atomic64_sub_return((i), (v)) == 0)
 #define atomic64_dec_and_test(v)	(atomic64_sub_return(1, (v)) == 0)
 #define atomic64_inc_and_test(v)	(atomic64_add_return(1, (v)) != 0)

_

> Can someone say with certainty whether the s390 version is also
> wrong?
> 

Either s390's atomic_inc_and_test() is wrong, or their atomic_inc_return()
is wrong.  I think the former.


David Mosberger <davidm@napali.hpl.hp.com>


---

 25-akpm/include/asm-s390/atomic.h |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

diff -puN include/asm-s390/atomic.h~s390-atomic_inc_and_test-fix include/asm-s390/atomic.h
--- 25/include/asm-s390/atomic.h~s390-atomic_inc_and_test-fix	Thu May 13 15:50:46 2004
+++ 25-akpm/include/asm-s390/atomic.h	Thu May 13 15:50:50 2004
@@ -72,7 +72,7 @@ static __inline__ int atomic_inc_return(
 
 static __inline__ int atomic_inc_and_test(volatile atomic_t * v)
 {
-	return __CS_LOOP(v, 1, "ar") != 0;
+	return __CS_LOOP(v, 1, "ar") == 0;
 }
 static __inline__ void atomic_dec(volatile atomic_t * v)
 {

_

  reply	other threads:[~2004-05-13 22:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-13 20:35 atomic ops for a VM fix Andrew Morton
2004-05-13 20:37 ` Andrew Morton
2004-05-13 21:52 ` Ivan Kokshaysky
2004-05-13 22:33   ` David Mosberger
2004-05-13 22:52     ` Andrew Morton [this message]
  -- strict thread matches above, loose matches on Subject: below --
2004-05-14 11:36 Martin Schwidefsky

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=20040513155248.4534f833.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=davidm@hpl.hp.com \
    --cc=davidm@napali.hpl.hp.com \
    --cc=ink@jurassic.park.msu.ru \
    --cc=linux-arch@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