[patch 24/41] cpu alloc: Use in the crypto subsystem.

Previous thread: [patch 19/41] cpu alloc: Convert loopback statistics by Christoph Lameter on Thursday, May 29, 2008 - 8:56 pm. (1 message)

Next thread: [patch 26/41] cpu alloc: Convert mib handling to cpu alloc by Christoph Lameter on Thursday, May 29, 2008 - 8:56 pm. (3 messages)
From: Christoph Lameter
Date: Thursday, May 29, 2008 - 8:56 pm

Use cpu alloc for the crypto subsystem.

Signed-off-by: Christoph Lameter <clameter@sgi.com>
---
 crypto/async_tx/async_tx.c |   19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

Index: linux-2.6/crypto/async_tx/async_tx.c
===================================================================
--- linux-2.6.orig/crypto/async_tx/async_tx.c	2008-04-29 14:55:49.000000000 -0700
+++ linux-2.6/crypto/async_tx/async_tx.c	2008-05-21 22:01:42.000000000 -0700
@@ -221,10 +221,10 @@
 	for_each_dma_cap_mask(cap, dma_cap_mask_all)
 		for_each_possible_cpu(cpu) {
 			struct dma_chan_ref *ref =
-				per_cpu_ptr(channel_table[cap], cpu)->ref;
+				CPU_PTR(channel_table[cap], cpu)->ref;
 			if (ref) {
 				atomic_set(&ref->count, 0);
-				per_cpu_ptr(channel_table[cap], cpu)->ref =
+				CPU_PTR(channel_table[cap], cpu)->ref =
 									NULL;
 			}
 		}
@@ -237,7 +237,7 @@
 			else
 				new = get_chan_ref_by_cap(cap, -1);
 
-			per_cpu_ptr(channel_table[cap], cpu)->ref = new;
+			CPU_PTR(channel_table[cap], cpu)->ref = new;
 		}
 
 	spin_unlock_irqrestore(&async_tx_lock, flags);
@@ -341,7 +341,8 @@
 	clear_bit(DMA_INTERRUPT, dma_cap_mask_all.bits);
 
 	for_each_dma_cap_mask(cap, dma_cap_mask_all) {
-		channel_table[cap] = alloc_percpu(struct chan_ref_percpu);
+		channel_table[cap] = CPU_ALLOC(struct chan_ref_percpu,
+						GFP_KERNEL | __GFP_ZERO);
 		if (!channel_table[cap])
 			goto err;
 	}
@@ -357,7 +358,7 @@
 	printk(KERN_ERR "async_tx: initialization failure\n");
 
 	while (--cap >= 0)
-		free_percpu(channel_table[cap]);
+		CPU_FREE(channel_table[cap]);
 
 	return 1;
 }
@@ -370,7 +371,7 @@
 
 	for_each_dma_cap_mask(cap, dma_cap_mask_all)
 		if (channel_table[cap])
-			free_percpu(channel_table[cap]);
+			CPU_FREE(channel_table[cap]);
 
 	dma_async_client_unregister(&async_tx_dma);
 }
@@ -390,10 +391,8 @@
 		dma_has_cap(tx_type, depend_tx->chan->device->cap_mask))
 		return depend_tx->chan;
 	else if (likely(channel_table_initialized)) ...
Previous thread: [patch 19/41] cpu alloc: Convert loopback statistics by Christoph Lameter on Thursday, May 29, 2008 - 8:56 pm. (1 message)

Next thread: [patch 26/41] cpu alloc: Convert mib handling to cpu alloc by Christoph Lameter on Thursday, May 29, 2008 - 8:56 pm. (3 messages)