[patch 23/41] cpu alloc: Use it for infiniband

From: Christoph Lameter
Date: Fri May 30 2008 - 00:13:53 EST


Use cpu alloc for infiniband.

Signed-off-by: Christoph Lameter <clameter@xxxxxxx>
---
drivers/infiniband/hw/ehca/ehca_irq.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)

Index: linux-2.6/drivers/infiniband/hw/ehca/ehca_irq.c
===================================================================
--- linux-2.6.orig/drivers/infiniband/hw/ehca/ehca_irq.c 2008-05-14 19:40:32.000000000 -0700
+++ linux-2.6/drivers/infiniband/hw/ehca/ehca_irq.c 2008-05-21 22:01:32.000000000 -0700
@@ -680,7 +680,7 @@
cpu_id = find_next_online_cpu(pool);
BUG_ON(!cpu_online(cpu_id));

- cct = per_cpu_ptr(pool->cpu_comp_tasks, cpu_id);
+ cct = CPU_PTR(pool->cpu_comp_tasks, cpu_id);
BUG_ON(!cct);

spin_lock_irqsave(&cct->task_lock, flags);
@@ -688,7 +688,7 @@
spin_unlock_irqrestore(&cct->task_lock, flags);
if (cq_jobs > 0) {
cpu_id = find_next_online_cpu(pool);
- cct = per_cpu_ptr(pool->cpu_comp_tasks, cpu_id);
+ cct = CPU_PTR(pool->cpu_comp_tasks, cpu_id);
BUG_ON(!cct);
}

@@ -761,7 +761,7 @@
{
struct ehca_cpu_comp_task *cct;

- cct = per_cpu_ptr(pool->cpu_comp_tasks, cpu);
+ cct = CPU_PTR(pool->cpu_comp_tasks, cpu);
spin_lock_init(&cct->task_lock);
INIT_LIST_HEAD(&cct->cq_list);
init_waitqueue_head(&cct->wait_queue);
@@ -777,7 +777,7 @@
struct task_struct *task;
unsigned long flags_cct;

- cct = per_cpu_ptr(pool->cpu_comp_tasks, cpu);
+ cct = CPU_PTR(pool->cpu_comp_tasks, cpu);

spin_lock_irqsave(&cct->task_lock, flags_cct);

@@ -793,7 +793,7 @@

static void __cpuinit take_over_work(struct ehca_comp_pool *pool, int cpu)
{
- struct ehca_cpu_comp_task *cct = per_cpu_ptr(pool->cpu_comp_tasks, cpu);
+ struct ehca_cpu_comp_task *cct = CPU_PTR(pool->cpu_comp_tasks, cpu);
LIST_HEAD(list);
struct ehca_cq *cq;
unsigned long flags_cct;
@@ -806,8 +806,7 @@
cq = list_entry(cct->cq_list.next, struct ehca_cq, entry);

list_del(&cq->entry);
- __queue_comp_task(cq, per_cpu_ptr(pool->cpu_comp_tasks,
- smp_processor_id()));
+ __queue_comp_task(cq, THIS_CPU(pool->cpu_comp_tasks));
}

spin_unlock_irqrestore(&cct->task_lock, flags_cct);
@@ -833,14 +832,14 @@
case CPU_UP_CANCELED:
case CPU_UP_CANCELED_FROZEN:
ehca_gen_dbg("CPU: %x (CPU_CANCELED)", cpu);
- cct = per_cpu_ptr(pool->cpu_comp_tasks, cpu);
+ cct = CPU_PTR(pool->cpu_comp_tasks, cpu);
kthread_bind(cct->task, any_online_cpu(cpu_online_map));
destroy_comp_task(pool, cpu);
break;
case CPU_ONLINE:
case CPU_ONLINE_FROZEN:
ehca_gen_dbg("CPU: %x (CPU_ONLINE)", cpu);
- cct = per_cpu_ptr(pool->cpu_comp_tasks, cpu);
+ cct = CPU_PTR(pool->cpu_comp_tasks, cpu);
kthread_bind(cct->task, cpu);
wake_up_process(cct->task);
break;
@@ -883,7 +882,8 @@
spin_lock_init(&pool->last_cpu_lock);
pool->last_cpu = any_online_cpu(cpu_online_map);

- pool->cpu_comp_tasks = alloc_percpu(struct ehca_cpu_comp_task);
+ pool->cpu_comp_tasks = CPU_ALLOC(struct ehca_cpu_comp_task,
+ GFP_KERNEL | __GFP_ZERO);
if (pool->cpu_comp_tasks == NULL) {
kfree(pool);
return -EINVAL;
@@ -917,6 +917,6 @@
if (cpu_online(i))
destroy_comp_task(pool, i);
}
- free_percpu(pool->cpu_comp_tasks);
+ CPU_FREE(pool->cpu_comp_tasks);
kfree(pool);
}

--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/