[patch 25/41] cpu alloc: scheduler: Convert cpuusage to cpu_alloc.

Christoph Lameter
2008-05-30T04:10:15Z

[-- Attachment #1: cpu_alloc_scheduler_usage_conversion --]
[-- Type: text/plain, Size: 1529 bytes --]

Convert scheduler handling of cpuusage to cpu alloc.

Signed-off-by: Christoph Lameter <clameter@sgi.com>

---
arch/x86/kernel/setup.c | 2 +-
kernel/sched.c | 10 +++++-----
mm/cpu_alloc.c | 25 +++++++++++++++++++------
3 files changed, 25 insertions(+), 12 deletions(-)

Index: linux-2.6/kernel/sched.c
===================================================================
--- linux-2.6.orig/kernel/sched.c 2008-05-26 20:38:49.000000000 -0700
+++ linux-2.6/kernel/sched.c 2008-05-26 20:38:53.000000000 -0700
@@ -9090,7 +9090,7 @@
if (!ca)
return ERR_PTR(-ENOMEM);

- ca->cpuusage = alloc_percpu(u64);
+ ca->cpuusage = CPU_ALLOC(u64, GFP_KERNEL|__GFP_ZERO);
if (!ca->cpuusage) {
kfree(ca);
return ERR_PTR(-ENOMEM);
@@ -9105,7 +9105,7 @@
{
struct cpuacct *ca = cgroup_ca(cgrp);

- free_percpu(ca->cpuusage);
+ CPU_FREE(ca->cpuusage);
kfree(ca);
}

@@ -9117,7 +9117,7 @@
int i;

for_each_possible_cpu(i) {
- u64 *cpuusage = percpu_ptr(ca->cpuusage, i);
+ u64 *cpuusage = CPU_PTR(cpuusage, i);

/*
* Take rq->lock to make 64-bit addition safe on 32-bit
@@ -9144,7 +9144,7 @@
}

for_each_possible_cpu(i) {
- u64 *cpuusage = percpu_ptr(ca->cpuusage, i);
+ u64 *cpuusage = CPU_PTR(ca->cpuusage, i);

spin_lock_irq(&cpu_rq(i)->lock);
*cpuusage = 0;
@@ -9181,7 +9181,7 @@

ca = task_ca(tsk);
if (ca) {
- u64 *cpuusage = percpu_ptr(ca->cpuusage, task_cpu(tsk));
+ u64 *cpuusage = CPU_PTR(ca->cpuusage, task_cpu(tsk));

*cpuusage += cputime;
}

--