public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] RT: update rcurefs for RT
@ 2005-09-27 18:32 Daniel Walker
  2005-09-28  9:32 ` Ingo Molnar
  2005-09-29 11:42 ` Ingo Molnar
  0 siblings, 2 replies; 7+ messages in thread
From: Daniel Walker @ 2005-09-27 18:32 UTC (permalink / raw)
  To: mingo; +Cc: linux-kernel


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);



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

* Re: [PATCH] RT: update rcurefs for RT
  2005-09-27 18:32 [PATCH] RT: update rcurefs for RT Daniel Walker
@ 2005-09-28  9:32 ` Ingo Molnar
  2005-09-29 11:42 ` Ingo Molnar
  1 sibling, 0 replies; 7+ messages in thread
From: Ingo Molnar @ 2005-09-28  9:32 UTC (permalink / raw)
  To: Daniel Walker; +Cc: linux-kernel


* Daniel Walker <dwalker@mvista.com> wrote:

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

thanks, applied.

	Ingo

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

* Re: [PATCH] RT: update rcurefs for RT
  2005-09-27 18:32 [PATCH] RT: update rcurefs for RT Daniel Walker
  2005-09-28  9:32 ` Ingo Molnar
@ 2005-09-29 11:42 ` Ingo Molnar
  2005-09-29 15:20   ` Daniel Walker
  1 sibling, 1 reply; 7+ messages in thread
From: Ingo Molnar @ 2005-09-29 11:42 UTC (permalink / raw)
  To: Daniel Walker; +Cc: linux-kernel


* Daniel Walker <dwalker@mvista.com> wrote:

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

> +static inline void init_rcurefs(void)
> +{
> +	int i;
> +	for (i=0; i < RCUREF_HASH_SIZE; i++) 
> +		SPIN_LOCK_UNLOCKED(__rcuref_hash[i]);

what the heck is this doing??? Patch reverted.

	Ingo

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

* Re: [PATCH] RT: update rcurefs for RT
  2005-09-29 11:42 ` Ingo Molnar
@ 2005-09-29 15:20   ` Daniel Walker
  2005-09-30  0:55     ` Thomas Gleixner
  0 siblings, 1 reply; 7+ messages in thread
From: Daniel Walker @ 2005-09-29 15:20 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: linux-kernel

On Thu, 2005-09-29 at 13:42 +0200, Ingo Molnar wrote:

> > +		SPIN_LOCK_UNLOCKED(__rcuref_hash[i]);
> 
> what the heck is this doing??? Patch reverted.

How is this ?

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++) 
+		__rcuref_hash[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);



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

* Re: [PATCH] RT: update rcurefs for RT
  2005-09-29 15:20   ` Daniel Walker
@ 2005-09-30  0:55     ` Thomas Gleixner
  2005-09-30  8:34       ` Ingo Molnar
  0 siblings, 1 reply; 7+ messages in thread
From: Thomas Gleixner @ 2005-09-30  0:55 UTC (permalink / raw)
  To: Daniel Walker; +Cc: Ingo Molnar, linux-kernel

On Thu, 2005-09-29 at 08:20 -0700, Daniel Walker wrote:
> +static inline void init_rcurefs(void)
> +{
> +	int i;
> +	for (i=0; i < RCUREF_HASH_SIZE; i++) 
> +		__rcuref_hash[i] = SPIN_LOCK_UNLOCKED(__rcuref_hash[i]);

Maybe a simple 

	spin_lock_init(&__rcuref_hash[i]);

would work all over tha place ?

tglx



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

* Re: [PATCH] RT: update rcurefs for RT
  2005-09-30  0:55     ` Thomas Gleixner
@ 2005-09-30  8:34       ` Ingo Molnar
  2005-09-30 14:17         ` Daniel Walker
  0 siblings, 1 reply; 7+ messages in thread
From: Ingo Molnar @ 2005-09-30  8:34 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: Daniel Walker, linux-kernel


* Thomas Gleixner <tglx@linutronix.de> wrote:

> On Thu, 2005-09-29 at 08:20 -0700, Daniel Walker wrote:
> > +static inline void init_rcurefs(void)
> > +{
> > +	int i;
> > +	for (i=0; i < RCUREF_HASH_SIZE; i++) 
> > +		__rcuref_hash[i] = SPIN_LOCK_UNLOCKED(__rcuref_hash[i]);
> 
> Maybe a simple 
> 
> 	spin_lock_init(&__rcuref_hash[i]);
> 
> would work all over the place ?

yep.

	Ingo

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

* Re: [PATCH] RT: update rcurefs for RT
  2005-09-30  8:34       ` Ingo Molnar
@ 2005-09-30 14:17         ` Daniel Walker
  0 siblings, 0 replies; 7+ messages in thread
From: Daniel Walker @ 2005-09-30 14:17 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Thomas Gleixner, linux-kernel

On Fri, 2005-09-30 at 10:34 +0200, Ingo Molnar wrote:
> * Thomas Gleixner <tglx@linutronix.de> wrote:
> 
> > On Thu, 2005-09-29 at 08:20 -0700, Daniel Walker wrote:
> > > +static inline void init_rcurefs(void)
> > > +{
> > > +	int i;
> > > +	for (i=0; i < RCUREF_HASH_SIZE; i++) 
> > > +		__rcuref_hash[i] = SPIN_LOCK_UNLOCKED(__rcuref_hash[i]);
> > 
> > Maybe a simple 
> > 
> > 	spin_lock_init(&__rcuref_hash[i]);
> > 
> > would work all over the place ?
> 
> yep.

The patch isn't needed if you accept Nick's cmpxchg() patches ..

Daniel


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

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

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-27 18:32 [PATCH] RT: update rcurefs for RT Daniel Walker
2005-09-28  9:32 ` 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

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