lkml.org 
[lkml]   [2007]   [Nov]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[patch 26/28] cpu alloc: Use for infiniband
Signed-off-by: Christoph Lameter <clameter@sgi.com>

---
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 2007-11-05 16:04:55.350534140 -0800
+++ linux-2.6/drivers/infiniband/hw/ehca/ehca_irq.c 2007-11-05 16:39:25.151283658 -0800
@@ -646,7 +646,7 @@ static void queue_comp_task(struct ehca_
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);
@@ -654,7 +654,7 @@ static void queue_comp_task(struct ehca_
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);
}

@@ -727,7 +727,7 @@ static struct task_struct *create_comp_t
{
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);
@@ -743,7 +743,7 @@ static void destroy_comp_task(struct ehc
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);

@@ -759,7 +759,7 @@ static void destroy_comp_task(struct ehc

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;
@@ -772,8 +772,7 @@ static void __cpuinit take_over_work(str
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);
@@ -799,14 +798,14 @@ static int __cpuinit comp_pool_callback(
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;
@@ -849,7 +848,8 @@ int ehca_create_comp_pool(void)
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;
@@ -883,6 +883,6 @@ void ehca_destroy_comp_pool(void)
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@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2007-11-06 21:09    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site