public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Daniel Walker <dwalker@mvista.com>
To: mingo@elte.hu
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] RT: update rcurefs for RT
Date: Tue, 27 Sep 2005 11:32:06 -0700	[thread overview]
Message-ID: <1127845926.4004.22.camel@dhcp153.mvista.com> (raw)


Make rcurefs compatible with RT w/o cmpxchg() .

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

Index: linux-2.6.13/kernel/rcupdate.c
===================================================================
--- linux-2.6.13.orig/kernel/rcupdate.c
+++ linux-2.6.13/kernel/rcupdate.c
@@ -96,6 +96,25 @@ static void rcu_torture_init(void);
 static inline void rcu_torture_init(void) { }
 #endif
 
+#ifndef __HAVE_ARCH_CMPXCHG
+/*
+ * We use an array of spinlocks for the rcurefs -- similar to ones in sparc
+ * 32 bit atomic_t implementations, and a hash function similar to that
+ * for our refcounting needs.
+ * Can't help multiprocessors which donot have cmpxchg :(
+ */
+spinlock_t __rcuref_hash[RCUREF_HASH_SIZE];
+
+static inline void init_rcurefs(void)
+{
+	int i;
+	for (i=0; i < RCUREF_HASH_SIZE; i++) 
+		SPIN_LOCK_UNLOCKED(__rcuref_hash[i]);
+}
+#else
+#define init_rcurefs()	do { } while (0)
+#endif
+
 #ifndef CONFIG_PREEMPT_RCU
 
 /* Definition for rcupdate control block. */
@@ -123,18 +142,6 @@ DEFINE_PER_CPU(struct rcu_data, rcu_bh_d
 static DEFINE_PER_CPU(struct tasklet_struct, rcu_tasklet) = {NULL};
 static int maxbatch = 10;
 
-#ifndef __HAVE_ARCH_CMPXCHG
-/*
- * We use an array of spinlocks for the rcurefs -- similar to ones in sparc
- * 32 bit atomic_t implementations, and a hash function similar to that
- * for our refcounting needs.
- * Can't help multiprocessors which donot have cmpxchg :(
- */
-
-spinlock_t __rcuref_hash[RCUREF_HASH_SIZE] = {
-	[0 ... (RCUREF_HASH_SIZE-1)] = SPIN_LOCK_UNLOCKED
-};
-#endif
 
 /**
  * call_rcu - Queue an RCU callback for invocation after a grace period.
@@ -487,6 +494,7 @@ static struct notifier_block __devinitda
  */
 void __init rcu_init(void)
 {
+	init_rcurefs();
 	rcu_torture_init();
 	rcu_cpu_notify(&rcu_nb, CPU_UP_PREPARE,
 			(void *)(long)smp_processor_id());
@@ -824,6 +832,7 @@ rcu_pending(int cpu)
 
 void __init rcu_init(void)
 {
+	init_rcurefs();
 	rcu_torture_init();
 /*&&&&*/printk("WARNING: experimental RCU implementation.\n");
 	spin_lock_init(&rcu_data.lock);



             reply	other threads:[~2005-09-27 18:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-27 18:32 Daniel Walker [this message]
2005-09-28  9:32 ` [PATCH] RT: update rcurefs for RT Ingo Molnar
2005-09-29 11:42 ` Ingo Molnar
2005-09-29 15:20   ` Daniel Walker
2005-09-30  0:55     ` Thomas Gleixner
2005-09-30  8:34       ` Ingo Molnar
2005-09-30 14:17         ` Daniel Walker

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=1127845926.4004.22.camel@dhcp153.mvista.com \
    --to=dwalker@mvista.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /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