* atomic ops for a VM fix
@ 2004-05-13 20:35 Andrew Morton
2004-05-13 20:37 ` Andrew Morton
2004-05-13 21:52 ` Ivan Kokshaysky
0 siblings, 2 replies; 6+ messages in thread
From: Andrew Morton @ 2004-05-13 20:35 UTC (permalink / raw)
To: linux-arch
Guys, I have four patches here which I'd like to merge into Linus's tree
within a week.
They require that the architecture implement atomic_add_negative() and
atomic_inc_and_test(). I managed to cobble these together for many
architectures, but there are a few gaps. Please review the third and
fourth patches.
Dave, sparc64 is missing atomic_add_negative(), sorry.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: atomic ops for a VM fix
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
1 sibling, 0 replies; 6+ messages in thread
From: Andrew Morton @ 2004-05-13 20:37 UTC (permalink / raw)
To: linux-arch
oh, and open-coded references to page->count are deliberately
broken at compile time. Please convert any leftovers to get_page(),
set_page_count(), page_count() and __put_page(), thanks.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: atomic ops for a VM fix
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
1 sibling, 1 reply; 6+ messages in thread
From: Ivan Kokshaysky @ 2004-05-13 21:52 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-arch
On Thu, May 13, 2004 at 01:35:26PM -0700, Andrew Morton wrote:
> They require that the architecture implement atomic_add_negative() and
> atomic_inc_and_test(). I managed to cobble these together for many
> architectures, but there are a few gaps. Please review the third and
> fourth patches.
It seems atomic_inc_and_test() is missing on alpha.
Ivan.
--- 2.6/include/asm-alpha/atomic.h Mon May 10 06:32:52 2004
+++ linux/include/asm-alpha/atomic.h Fri May 14 01:41:57 2004
@@ -178,6 +178,7 @@ static __inline__ long atomic64_sub_retu
#define atomic_sub_and_test(i,v) (atomic_sub_return((i), (v)) == 0)
#define atomic64_sub_and_test(i,v) (atomic64_sub_return((i), (v)) == 0)
+#define atomic_inc_and_test(v) (atomic_add_return(1, (v)) == 0)
#define atomic_dec_and_test(v) (atomic_sub_return(1, (v)) == 0)
#define atomic64_dec_and_test(v) (atomic64_sub_return(1, (v)) == 0)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: atomic ops for a VM fix
2004-05-13 21:52 ` Ivan Kokshaysky
@ 2004-05-13 22:33 ` David Mosberger
2004-05-13 22:52 ` Andrew Morton
0 siblings, 1 reply; 6+ messages in thread
From: David Mosberger @ 2004-05-13 22:33 UTC (permalink / raw)
To: Ivan Kokshaysky; +Cc: Andrew Morton, linux-arch
>>>>> 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.
Can someone say with certainty whether the s390 version is also
wrong?
--david
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: atomic ops for a VM fix
2004-05-13 22:33 ` David Mosberger
@ 2004-05-13 22:52 ` Andrew Morton
0 siblings, 0 replies; 6+ messages in thread
From: Andrew Morton @ 2004-05-13 22:52 UTC (permalink / raw)
To: davidm; +Cc: davidm, ink, linux-arch
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)
{
_
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: atomic ops for a VM fix
@ 2004-05-14 11:36 Martin Schwidefsky
0 siblings, 0 replies; 6+ messages in thread
From: Martin Schwidefsky @ 2004-05-14 11:36 UTC (permalink / raw)
To: Andrew Morton; +Cc: davidm, davidm, ink, linux-arch
> Either s390's atomic_inc_and_test() is wrong, or their
atomic_inc_return()
> is wrong. I think the former.
atomic_inc_return is fine, atomic_inc_and_test is broken. The __CS_LOOP always
returns the new value.
blue skies,
Martin
Linux/390 Design & Development, IBM Deutschland Entwicklung GmbH
Schönaicherstr. 220, D-71032 Böblingen, Telefon: 49 - (0)7031 - 16-2247
E-Mail: schwidefsky@de.ibm.com
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2004-05-14 11:40 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
-- strict thread matches above, loose matches on Subject: below --
2004-05-14 11:36 Martin Schwidefsky
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox