linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] 2.5.39-mm1 fixes 1/3
@ 2002-09-30 11:13 Dipankar Sarma
  2002-09-30 11:15 ` [PATCH] 2.5.39-mm1 fixes 2/3 Dipankar Sarma
  0 siblings, 1 reply; 3+ messages in thread
From: Dipankar Sarma @ 2002-09-30 11:13 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

Hi Andrew,

rcu_ltimer was used mostly for performance measurements and wasn't
completely preemption friendly. With this fix (against 2.5.39-mm1), 
it should be now.

Thanks
-- 
Dipankar Sarma  <dipankar@in.ibm.com> http://lse.sourceforge.net
Linux Technology Center, IBM Software Lab, Bangalore, India.


--- kernel/rcupdate.c.orig	Mon Sep 30 13:55:15 2002
+++ kernel/rcupdate.c	Mon Sep 30 13:55:29 2002
@@ -60,12 +60,13 @@
  */
 void call_rcu(struct rcu_head *head, void (*func)(void *arg), void *arg)
 {
-	int cpu = smp_processor_id();
+	int cpu;
 	unsigned long flags;
 
 	head->func = func;
 	head->arg = arg;
 	local_irq_save(flags);
+	cpu = smp_processor_id();
 	list_add_tail(&head->list, &RCU_nxtlist(cpu));
 	local_irq_restore(flags);
 }

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

* Re: [PATCH] 2.5.39-mm1 fixes 2/3
  2002-09-30 11:13 [PATCH] 2.5.39-mm1 fixes 1/3 Dipankar Sarma
@ 2002-09-30 11:15 ` Dipankar Sarma
  2002-09-30 11:17   ` [PATCH] 2.5.39-mm1 fixes 3/3 Dipankar Sarma
  0 siblings, 1 reply; 3+ messages in thread
From: Dipankar Sarma @ 2002-09-30 11:15 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

The read_barrier_depends patch didn't have compilable list_for_each_rcu()
macros. These macros allow a simpler interface to use RCU by taking
care of memory barriers. Fix against 2.5.39-mm1.

Thanks
-- 
Dipankar Sarma  <dipankar@in.ibm.com> http://lse.sourceforge.net
Linux Technology Center, IBM Software Lab, Bangalore, India.


--- include/linux/list.h.orig	Mon Sep 30 13:59:10 2002
+++ include/linux/list.h	Mon Sep 30 13:59:23 2002
@@ -307,7 +307,7 @@
  */
 #define list_for_each_rcu(pos, head) \
 	for (pos = (head)->next, prefetch(pos->next); pos != (head); \
-        	pos = pos->next, ({ read_barrier_depends(); 0}), prefetch(pos->next))
+        	pos = pos->next, ({ read_barrier_depends(); 0;}), prefetch(pos->next))
         	
 /**
  * list_for_each_safe_rcu	-	iterate over an rcu-protected list safe
@@ -318,7 +318,7 @@
  */
 #define list_for_each_safe_rcu(pos, n, head) \
 	for (pos = (head)->next, n = pos->next; pos != (head); \
-		pos = n, ({ read_barrier_depends(); 0}), n = pos->next)
+		pos = n, ({ read_barrier_depends(); 0;}), n = pos->next)
 
 #endif /* __KERNEL__ || _LVM_H_INCLUDE */
 

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

* Re: [PATCH] 2.5.39-mm1 fixes 3/3
  2002-09-30 11:15 ` [PATCH] 2.5.39-mm1 fixes 2/3 Dipankar Sarma
@ 2002-09-30 11:17   ` Dipankar Sarma
  0 siblings, 0 replies; 3+ messages in thread
From: Dipankar Sarma @ 2002-09-30 11:17 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

The dcache_rcu patch should use the RCU list macros which make sure
of the barrier requirements. Fix against 2.5.39-mm1.

Thanks
-- 
Dipankar Sarma  <dipankar@in.ibm.com> http://lse.sourceforge.net
Linux Technology Center, IBM Software Lab, Bangalore, India.


--- fs/dcache.c.orig	Mon Sep 30 14:00:40 2002
+++ fs/dcache.c	Mon Sep 30 14:05:33 2002
@@ -869,14 +869,8 @@
 	struct dentry *found = NULL;
 
 	rcu_read_lock();
-	tmp = head->next;
-	for (;;) {
-		struct dentry * dentry;
-		read_barrier_depends();
-	       	dentry = list_entry(tmp, struct dentry, d_hash);
-		if (tmp == head)
-			break;
-		tmp = tmp->next;
+	list_for_each_rcu(tmp, head) {
+		struct dentry * dentry = list_entry(tmp, struct dentry, d_hash);
 		if (dentry->d_name.hash != hash)
 			continue;
 		if (dentry->d_parent != parent)
@@ -999,7 +993,7 @@
 	struct list_head *list = d_hash(entry->d_parent, entry->d_name.hash);
 	spin_lock(&dcache_lock);
 	if (!list_empty(&entry->d_hash) && !d_unhashed(entry)) BUG();
-	list_add(&entry->d_hash, list);
+	list_add_rcu(&entry->d_hash, list);
 	entry->d_vfs_flags &= ~DCACHE_UNHASHED;
 	spin_unlock(&dcache_lock);
 }

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

end of thread, other threads:[~2002-09-30 11:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-09-30 11:13 [PATCH] 2.5.39-mm1 fixes 1/3 Dipankar Sarma
2002-09-30 11:15 ` [PATCH] 2.5.39-mm1 fixes 2/3 Dipankar Sarma
2002-09-30 11:17   ` [PATCH] 2.5.39-mm1 fixes 3/3 Dipankar Sarma

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).