Index: linux-2.6.10-rc2-bk13-Percpu/net/ipv4/ipcomp.c =================================================================== --- linux-2.6.10-rc2-bk13-Percpu.orig/net/ipv4/ipcomp.c 2004-10-19 14:34:25.000000000 +1000 +++ linux-2.6.10-rc2-bk13-Percpu/net/ipv4/ipcomp.c 2004-12-02 15:08:15.000000000 +1100 @@ -54,8 +54,8 @@ start = skb->data; cpu = get_cpu(); - scratch = *per_cpu_ptr(ipcomp_scratches, cpu); - tfm = *per_cpu_ptr(ipcd->tfms, cpu); + scratch = *__getcpu_ptr(ipcomp_scratches); + tfm = *__get_cpu_ptr(ipcd->tfms); err = crypto_comp_decompress(tfm, start, plen, scratch, &dlen); if (err) @@ -131,8 +131,8 @@ start = skb->data + ihlen; cpu = get_cpu(); - scratch = *per_cpu_ptr(ipcomp_scratches, cpu); - tfm = *per_cpu_ptr(ipcd->tfms, cpu); + scratch = *__get_cpu_ptr(ipcomp_scratches); + tfm = *__get_cpu_ptr(ipcd->tfms); err = crypto_comp_compress(tfm, start, plen, scratch, &dlen); if (err) @@ -374,14 +374,12 @@ struct crypto_tfm **tfms; int cpu; - /* This can be any valid CPU ID so we don't need locking. */ - cpu = smp_processor_id(); - list_for_each_entry(pos, &ipcomp_tfms_list, list) { struct crypto_tfm *tfm; tfms = pos->tfms; - tfm = *per_cpu_ptr(tfms, cpu); + /* This can be any valid CPU ID so we don't need locking. */ + tfm = *__get_cpu_ptr(tfms); if (!strcmp(crypto_tfm_alg_name(tfm), alg_name)) { pos->users++; Index: linux-2.6.10-rc2-bk13-Percpu/mm/swap.c =================================================================== --- linux-2.6.10-rc2-bk13-Percpu.orig/mm/swap.c 2004-09-28 16:22:19.000000000 +1000 +++ linux-2.6.10-rc2-bk13-Percpu/mm/swap.c 2004-12-02 15:05:10.000000000 +1100 @@ -451,7 +451,7 @@ long *pcount; int cpu = get_cpu(); - pcount = per_cpu_ptr(fbc->counters, cpu); + pcount = __get_cpu_ptr(fbc->counters); count = *pcount + amount; if (count >= FBC_BATCH || count <= -FBC_BATCH) { spin_lock(&fbc->lock); Index: linux-2.6.10-rc2-bk13-Percpu/include/net/neighbour.h =================================================================== --- linux-2.6.10-rc2-bk13-Percpu.orig/include/net/neighbour.h 2004-11-16 15:30:08.000000000 +1100 +++ linux-2.6.10-rc2-bk13-Percpu/include/net/neighbour.h 2004-12-02 15:20:24.000000000 +1100 @@ -114,7 +114,7 @@ #define NEIGH_CACHE_STAT_INC(tbl, field) \ do { \ preempt_disable(); \ - (per_cpu_ptr((tbl)->stats, smp_processor_id())->field)++; \ + (__get_cpu_ptr((tbl)->stats)->field)++; \ preempt_enable(); \ } while (0) Index: linux-2.6.10-rc2-bk13-Percpu/net/ipv6/ipcomp6.c =================================================================== --- linux-2.6.10-rc2-bk13-Percpu.orig/net/ipv6/ipcomp6.c 2004-10-19 14:34:26.000000000 +1000 +++ linux-2.6.10-rc2-bk13-Percpu/net/ipv6/ipcomp6.c 2004-12-02 15:09:32.000000000 +1100 @@ -102,8 +102,8 @@ start = skb->data; cpu = get_cpu(); - scratch = *per_cpu_ptr(ipcomp6_scratches, cpu); - tfm = *per_cpu_ptr(ipcd->tfms, cpu); + scratch = *__get_cpu_ptr(ipcomp6_scratches); + tfm = *__get_cpu_ptr(ipcd->tfms); err = crypto_comp_decompress(tfm, start, plen, scratch, &dlen); if (err) { @@ -172,8 +172,8 @@ start = skb->h.raw; cpu = get_cpu(); - scratch = *per_cpu_ptr(ipcomp6_scratches, cpu); - tfm = *per_cpu_ptr(ipcd->tfms, cpu); + scratch = *__get_cpu_ptr(ipcomp6_scratches); + tfm = *__get_cpu_ptr(ipcd->tfms); err = crypto_comp_compress(tfm, start, plen, scratch, &dlen); if (err) { @@ -368,14 +368,12 @@ struct crypto_tfm **tfms; int cpu; - /* This can be any valid CPU ID so we don't need locking. */ - cpu = smp_processor_id(); - list_for_each_entry(pos, &ipcomp6_tfms_list, list) { struct crypto_tfm *tfm; tfms = pos->tfms; - tfm = *per_cpu_ptr(tfms, cpu); + /* This can be any valid CPU ID so we don't need locking. */ + tfm = *__get_cpu_ptr(tfms); if (!strcmp(crypto_tfm_alg_name(tfm), alg_name)) { pos->users++; Index: linux-2.6.10-rc2-bk13-Percpu/include/net/route.h =================================================================== --- linux-2.6.10-rc2-bk13-Percpu.orig/include/net/route.h 2004-10-19 14:34:22.000000000 +1000 +++ linux-2.6.10-rc2-bk13-Percpu/include/net/route.h 2004-12-02 15:03:21.000000000 +1100 @@ -105,7 +105,7 @@ extern struct rt_cache_stat *rt_cache_stat; #define RT_CACHE_STAT_INC(field) \ - (per_cpu_ptr(rt_cache_stat, smp_processor_id())->field++) + (__get_cpu_ptr(rt_cache_stat)->field++) extern struct ip_rt_acct *ip_rt_acct; Index: linux-2.6.10-rc2-bk13-Percpu/include/net/snmp.h =================================================================== --- linux-2.6.10-rc2-bk13-Percpu.orig/include/net/snmp.h 2004-09-28 16:22:18.000000000 +1000 +++ linux-2.6.10-rc2-bk13-Percpu/include/net/snmp.h 2004-12-02 15:04:15.000000000 +1100 @@ -128,18 +128,18 @@ #define SNMP_STAT_USRPTR(name) (name[1]) #define SNMP_INC_STATS_BH(mib, field) \ - (per_cpu_ptr(mib[0], smp_processor_id())->mibs[field]++) + (__get_cpu_ptr(mib[0])->mibs[field]++) #define SNMP_INC_STATS_OFFSET_BH(mib, field, offset) \ - (per_cpu_ptr(mib[0], smp_processor_id())->mibs[field + (offset)]++) + (__get_cpu_ptr(mib[0])->mibs[field + (offset)]++) #define SNMP_INC_STATS_USER(mib, field) \ - (per_cpu_ptr(mib[1], smp_processor_id())->mibs[field]++) + (__get_cpu_ptr(mib[1])->mibs[field]++) #define SNMP_INC_STATS(mib, field) \ - (per_cpu_ptr(mib[!in_softirq()], smp_processor_id())->mibs[field]++) + (__get_cpu_ptr(mib[!in_softirq()])->mibs[field]++) #define SNMP_DEC_STATS(mib, field) \ - (per_cpu_ptr(mib[!in_softirq()], smp_processor_id())->mibs[field]--) + (__get_cpu_ptr(mib[!in_softirq()])->mibs[field]--) #define SNMP_ADD_STATS_BH(mib, field, addend) \ - (per_cpu_ptr(mib[0], smp_processor_id())->mibs[field] += addend) + (__get_cpu_ptr(mib[0])->mibs[field] += addend) #define SNMP_ADD_STATS_USER(mib, field, addend) \ - (per_cpu_ptr(mib[1], smp_processor_id())->mibs[field] += addend) + (__get_cpu_ptr(mib[1])->mibs[field] += addend) #endif Index: linux-2.6.10-rc2-bk13-Percpu/kernel/sched.c =================================================================== --- linux-2.6.10-rc2-bk13-Percpu.orig/kernel/sched.c 2004-11-30 12:45:23.000000000 +1100 +++ linux-2.6.10-rc2-bk13-Percpu/kernel/sched.c 2004-12-02 15:54:22.035637840 +1100 @@ -1208,12 +1208,10 @@ void fastcall wake_up_new_task(task_t * p, unsigned long clone_flags) { unsigned long flags; - int this_cpu, cpu; runqueue_t *rq, *this_rq; rq = task_rq_lock(p, &flags); - cpu = task_cpu(p); - this_cpu = smp_processor_id(); + this_rq = this_rq(); BUG_ON(p->state != TASK_RUNNING); @@ -1231,7 +1229,7 @@ p->prio = effective_prio(p); - if (likely(cpu == this_cpu)) { + if (likely(rq == this_rq)) { if (!(clone_flags & CLONE_VM)) { /* * The VM isn't cloned, so we're in a good position to @@ -1252,15 +1250,12 @@ /* Run child last */ __activate_task(p, rq); /* - * We skip the following code due to cpu == this_cpu + * We skip the following code due to rq == this_rq * * task_rq_unlock(rq, &flags); * this_rq = task_rq_lock(current, &flags); */ - this_rq = rq; } else { - this_rq = cpu_rq(this_cpu); - /* * Not the local CPU - must adjust timestamp. This should * get optimised away in the !CONFIG_SMP case. @@ -1277,7 +1272,9 @@ * parent runqueue to update the parent's ->sleep_avg: */ task_rq_unlock(rq, &flags); - this_rq = task_rq_lock(current, &flags); + + /* By definition, returns this_rq. */ + task_rq_lock(current, &flags); } current->sleep_avg = JIFFIES_TO_NS(CURRENT_BONUS(current) * PARENT_PENALTY / 100 * MAX_SLEEP_AVG / MAX_BONUS);