public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] RT: Checks for cmpxchg in get_task_struct_rcu()
@ 2005-09-21 23:37 Daniel Walker
  2005-09-22  0:59 ` Nick Piggin
  0 siblings, 1 reply; 11+ messages in thread
From: Daniel Walker @ 2005-09-21 23:37 UTC (permalink / raw)
  To: mingo; +Cc: linux-kernel


Adds a check for cmpxchg in get_task_struct_rcu(), and implements the
case when it doesn't exist.

Signed-Off-By: Daniel Walker <dwalker@mvista.com>

Index: linux-2.6.13/include/linux/sched.h
===================================================================
--- linux-2.6.13.orig/include/linux/sched.h
+++ linux-2.6.13/include/linux/sched.h
@@ -1026,13 +1026,21 @@ static inline int get_task_struct_rcu(st
 {
 	int oldusage;
 
+#ifdef __HAVE_ARCH_CMPXCHG
 	do {
 		oldusage = atomic_read(&t->usage);
 		if (oldusage == 0) {
 			return 0;
 		}
 	} while (cmpxchg(&t->usage.counter,
-		 oldusage, oldusage + 1) != oldusage);
+				oldusage, oldusage + 1) != oldusage);
+#else
+	oldusage = atomic_read(&t->usage);
+	if (oldusage == 0) {
+		return 0;
+	}
+	atomic_inc(&t->usage);
+#endif
 	return 1;
 }
 



^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2005-09-26 14:44 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-21 23:37 [PATCH] RT: Checks for cmpxchg in get_task_struct_rcu() Daniel Walker
2005-09-22  0:59 ` Nick Piggin
2005-09-22  2:18   ` Daniel Walker
2005-09-22  3:27     ` Nick Piggin
2005-09-22  4:50     ` Daniel Walker
2005-09-22  5:05       ` Nick Piggin
2005-09-26  6:25       ` Ingo Molnar
2005-09-26 14:44         ` Daniel Walker
2005-09-26  6:26   ` Ingo Molnar
2005-09-26  6:39     ` Nick Piggin
2005-09-26  6:48       ` Ingo Molnar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox