Convert scratch handling in the network stack to cpu alloc. Signed-off-by: Christoph Lameter --- net/ipv4/ipcomp.c | 26 +++++++++++++------------- net/ipv6/ipcomp6.c | 26 +++++++++++++------------- 2 files changed, 26 insertions(+), 26 deletions(-) Index: linux-2.6/net/ipv4/ipcomp.c =================================================================== --- linux-2.6.orig/net/ipv4/ipcomp.c 2008-04-29 14:55:55.000000000 -0700 +++ linux-2.6/net/ipv4/ipcomp.c 2008-05-21 21:48:14.000000000 -0700 @@ -47,8 +47,8 @@ int dlen = IPCOMP_SCRATCH_SIZE; const u8 *start = skb->data; const int cpu = get_cpu(); - u8 *scratch = *per_cpu_ptr(ipcomp_scratches, cpu); - struct crypto_comp *tfm = *per_cpu_ptr(ipcd->tfms, cpu); + u8 *scratch = *CPU_PTR(ipcomp_scratches, cpu); + struct crypto_comp *tfm = *CPU_PTR(ipcd->tfms, cpu); int err = crypto_comp_decompress(tfm, start, plen, scratch, &dlen); if (err) @@ -105,8 +105,8 @@ int dlen = IPCOMP_SCRATCH_SIZE; u8 *start = skb->data; const int cpu = get_cpu(); - u8 *scratch = *per_cpu_ptr(ipcomp_scratches, cpu); - struct crypto_comp *tfm = *per_cpu_ptr(ipcd->tfms, cpu); + u8 *scratch = *CPU_PTR(ipcomp_scratches, cpu); + struct crypto_comp *tfm = *CPU_PTR(ipcd->tfms, cpu); int err; local_bh_disable(); @@ -254,9 +254,9 @@ return; for_each_possible_cpu(i) - vfree(*per_cpu_ptr(scratches, i)); + vfree(*CPU_PTR(scratches, i)); - free_percpu(scratches); + CPU_FREE(scratches); } static void **ipcomp_alloc_scratches(void) @@ -267,7 +267,7 @@ if (ipcomp_scratch_users++) return ipcomp_scratches; - scratches = alloc_percpu(void *); + scratches = CPU_ALLOC(void *, GFP_KERNEL); if (!scratches) return NULL; @@ -277,7 +277,7 @@ void *scratch = vmalloc(IPCOMP_SCRATCH_SIZE); if (!scratch) return NULL; - *per_cpu_ptr(scratches, i) = scratch; + *CPU_PTR(scratches, i) = scratch; } return scratches; @@ -305,10 +305,10 @@ return; for_each_possible_cpu(cpu) { - struct crypto_comp *tfm = *per_cpu_ptr(tfms, cpu); + struct crypto_comp *tfm = *CPU_PTR(tfms, cpu); crypto_free_comp(tfm); } - free_percpu(tfms); + CPU_FREE(tfms); } static struct crypto_comp **ipcomp_alloc_tfms(const char *alg_name) @@ -324,7 +324,7 @@ struct crypto_comp *tfm; tfms = pos->tfms; - tfm = *per_cpu_ptr(tfms, cpu); + tfm = *CPU_PTR(tfms, cpu); if (!strcmp(crypto_comp_name(tfm), alg_name)) { pos->users++; @@ -340,7 +340,7 @@ INIT_LIST_HEAD(&pos->list); list_add(&pos->list, &ipcomp_tfms_list); - pos->tfms = tfms = alloc_percpu(struct crypto_comp *); + pos->tfms = tfms = CPU_ALLOC(struct crypto_comp *, GFP_KERNEL); if (!tfms) goto error; @@ -349,7 +349,7 @@ CRYPTO_ALG_ASYNC); if (IS_ERR(tfm)) goto error; - *per_cpu_ptr(tfms, cpu) = tfm; + *CPU_PTR(tfms, cpu) = tfm; } return tfms; Index: linux-2.6/net/ipv6/ipcomp6.c =================================================================== --- linux-2.6.orig/net/ipv6/ipcomp6.c 2008-04-29 14:55:55.000000000 -0700 +++ linux-2.6/net/ipv6/ipcomp6.c 2008-05-21 21:47:09.000000000 -0700 @@ -90,8 +90,8 @@ start = skb->data; cpu = get_cpu(); - scratch = *per_cpu_ptr(ipcomp6_scratches, cpu); - tfm = *per_cpu_ptr(ipcd->tfms, cpu); + scratch = *CPU_PTR(ipcomp6_scratches, cpu); + tfm = *CPU_PTR(ipcd->tfms, cpu); err = crypto_comp_decompress(tfm, start, plen, scratch, &dlen); if (err) @@ -142,8 +142,8 @@ start = skb->data; cpu = get_cpu(); - scratch = *per_cpu_ptr(ipcomp6_scratches, cpu); - tfm = *per_cpu_ptr(ipcd->tfms, cpu); + scratch = *CPU_PTR(ipcomp6_scratches, cpu); + tfm = *CPU_PTR(ipcd->tfms, cpu); local_bh_disable(); err = crypto_comp_compress(tfm, start, plen, scratch, &dlen); @@ -264,12 +264,12 @@ return; for_each_possible_cpu(i) { - void *scratch = *per_cpu_ptr(scratches, i); + void *scratch = *CPU_PTR(scratches, i); vfree(scratch); } - free_percpu(scratches); + CPU_FREE(scratches); } static void **ipcomp6_alloc_scratches(void) @@ -280,7 +280,7 @@ if (ipcomp6_scratch_users++) return ipcomp6_scratches; - scratches = alloc_percpu(void *); + scratches = CPU_ALLOC(void *, GFP_KERNEL); if (!scratches) return NULL; @@ -290,7 +290,7 @@ void *scratch = vmalloc(IPCOMP_SCRATCH_SIZE); if (!scratch) return NULL; - *per_cpu_ptr(scratches, i) = scratch; + *CPU_PTR(scratches, i) = scratch; } return scratches; @@ -318,10 +318,10 @@ return; for_each_possible_cpu(cpu) { - struct crypto_comp *tfm = *per_cpu_ptr(tfms, cpu); + struct crypto_comp *tfm = *CPU_PTR(tfms, cpu); crypto_free_comp(tfm); } - free_percpu(tfms); + CPU_FREE(tfms); } static struct crypto_comp **ipcomp6_alloc_tfms(const char *alg_name) @@ -337,7 +337,7 @@ struct crypto_comp *tfm; tfms = pos->tfms; - tfm = *per_cpu_ptr(tfms, cpu); + tfm = *CPU_PTR(tfms, cpu); if (!strcmp(crypto_comp_name(tfm), alg_name)) { pos->users++; @@ -353,7 +353,7 @@ INIT_LIST_HEAD(&pos->list); list_add(&pos->list, &ipcomp6_tfms_list); - pos->tfms = tfms = alloc_percpu(struct crypto_comp *); + pos->tfms = tfms = CPU_ALLOC(struct crypto_comp *, GFP_KERNEL); if (!tfms) goto error; @@ -362,7 +362,7 @@ CRYPTO_ALG_ASYNC); if (IS_ERR(tfm)) goto error; - *per_cpu_ptr(tfms, cpu) = tfm; + *CPU_PTR(tfms, cpu) = tfm; } return tfms; -- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/