Signed-off-by: Christoph Lameter <clameter@sgi.com>
---
kernel/rcutorture.c | 4 ++--
kernel/srcu.c | 11 ++++++-----
2 files changed, 8 insertions(+), 7 deletions(-)
Index: linux-2.6/kernel/rcutorture.c
===================================================================
--- linux-2.6.orig/kernel/rcutorture.c 2007-11-15 21:17:24.515654132 -0800
+++ linux-2.6/kernel/rcutorture.c 2007-11-15 21:25:32.102406141 -0800
@@ -441,8 +441,8 @@ static int srcu_torture_stats(char *page
torture_type, TORTURE_FLAG, idx);
for_each_possible_cpu(cpu) {
cnt += sprintf(&page[cnt], " %d(%d,%d)", cpu,
- per_cpu_ptr(srcu_ctl.per_cpu_ref, cpu)->c[!idx],
- per_cpu_ptr(srcu_ctl.per_cpu_ref, cpu)->c[idx]);
+ CPU_PTR(srcu_ctl.per_cpu_ref, cpu)->c[!idx],
+ CPU_PTR(srcu_ctl.per_cpu_ref, cpu)->c[idx]);
}
cnt += sprintf(&page[cnt], "\n");
return cnt;
Index: linux-2.6/kernel/srcu.c
===================================================================
--- linux-2.6.orig/kernel/srcu.c 2007-11-15 21:17:24.523654368 -0800
+++ linux-2.6/kernel/srcu.c 2007-11-15 21:25:32.102406141 -0800
@@ -46,7 +46,8 @@ int init_srcu_struct(struct srcu_struct
{
sp->completed = 0;
mutex_init(&sp->mutex);
- sp->per_cpu_ref = alloc_percpu(struct srcu_struct_array);
+ sp->per_cpu_ref = CPU_ALLOC(struct srcu_struct_array,
+ GFP_KERNEL|__GFP_ZERO);
return (sp->per_cpu_ref ? 0 : -ENOMEM);
}
@@ -62,7 +63,7 @@ static int srcu_readers_active_idx(struc
sum = 0;
for_each_possible_cpu(cpu)
- sum += per_cpu_ptr(sp->per_cpu_ref, cpu)->c[idx];
+ sum += CPU_PTR(sp->per_cpu_ref, cpu)->c[idx];
return sum;
}
@@ -94,7 +95,7 @@ void cleanup_srcu_struct(struct srcu_str
WARN_ON(sum); /* Leakage unless caller handles error. */
if (sum != 0)
return;
- free_percpu(sp->per_cpu_ref);
+ CPU_FREE(sp->per_cpu_ref);
sp->per_cpu_ref = NULL;
}
@@ -113,7 +114,7 @@ int srcu_read_lock(struct srcu_struct *s
preempt_disable();
idx = sp->completed & 0x1;
barrier(); /* ensure compiler looks -once- at sp->completed. */
- per_cpu_ptr(sp->per_cpu_ref, smp_processor_id())->c[idx]++;
+ THIS_CPU(sp->per_cpu_ref)->c[idx]++;
srcu_barrier(); /* ensure compiler won't misorder critical section. */
preempt_enable();
return idx;
@@ -133,7 +134,7 @@ void srcu_read_unlock(struct srcu_struct
{
preempt_disable();
srcu_barrier(); /* ensure compiler won't misorder critical section. */
- per_cpu_ptr(sp->per_cpu_ref, smp_processor_id())->c[idx]--;
+ THIS_CPU(sp->per_cpu_ref)->c[idx]--;
preempt_enable();
}
--
-
| Jeff Garzik | Re: Dual-Licensing Linux Kernel with GPL V2 and GPL V3 |
| Christoph Hellwig | Re: [malware-list] [RFC 0/5] [TALPA] Intro to a linux interface for on access scan... |
| Heiko Carstens | Re: -mm merge plans for 2.6.23 -- sys_fallocate |
| Greg KH | [GIT PATCH] driver core patches against 2.6.24 |
git: | |
| Jarek Poplawski | [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock(). |
| Arjan van de Ven | Re: [GIT]: Networking |
| Jens Axboe | Re: [BUG] New Kernel Bugs |
| Gerrit Renker | [PATCH 27/37] dccp: Integration of dynamic feature activation - part 2 (server side) |
| Emmanuel Dreyfus | fixing send(2) semantics (kern/29750) |
| Christos Zoulas | Re: Melting down your network [Subject changed] |
| Juan RP | Changing the I/O scheduler on-the-fly |
| Emmanuel Dreyfus | Re: fixing send(2) semantics (kern/29750) |
