2.5.39-mm1 fixes 1/3
PATCH 1/1 2.5.39-mm1 fixes 1/3
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
Signature · 21 lines
Dipankar Sarma <[email protected]> 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); }
Re: [PATCH] 2.5.39-mm1 fixes 2/3
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
Signature · 23 lines
Dipankar Sarma <[email protected]> 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 */
Re: [PATCH] 2.5.39-mm1 fixes 3/3
The dcache_rcu patch should use the RCU list macros which make sure of the barrier requirements. Fix against 2.5.39-mm1.
Thanks
Signature · 32 lines
Dipankar Sarma <[email protected]> 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); }