[PATCH 2/6] cleanup account_system_vtime with this_cpu_* -v1

From: Venkatesh Pallipadi
Date: Mon Oct 25 2010 - 18:31:10 EST


this_cpu_* variants are optimal than per_cpu(). Cleanup
IRQ_TIME_ACCOUNTING account_system_vtime to use this_cpu_*.

Signed-off-by: Venkatesh Pallipadi <venki@xxxxxxxxxx>
---
kernel/sched.c | 14 ++++++--------
1 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/kernel/sched.c b/kernel/sched.c
index fae668b..a37bb83 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -1966,7 +1966,6 @@ static u64 irq_time_cpu(int cpu)
void account_system_vtime(struct task_struct *curr)
{
unsigned long flags;
- int cpu;
u64 now, delta;

if (!sched_clock_irqtime)
@@ -1974,20 +1973,19 @@ void account_system_vtime(struct task_struct *curr)

local_irq_save(flags);

- cpu = smp_processor_id();
- now = sched_clock_cpu(cpu);
- delta = now - per_cpu(irq_start_time, cpu);
- per_cpu(irq_start_time, cpu) = now;
+ now = sched_clock_cpu(smp_processor_id());
+ delta = now - this_cpu_read(irq_start_time);
+ this_cpu_write(irq_start_time, now);
/*
* We do not account for softirq time from ksoftirqd here.
* We want to continue accounting softirq time to ksoftirqd thread
* in that case, so as not to confuse scheduler with a special task
* that do not consume any time, but still wants to run.
*/
- if (hardirq_count())
- per_cpu(cpu_hardirq_time, cpu) += delta;
+ if (in_irq())
+ this_cpu_add(cpu_hardirq_time, delta);
else if (in_serving_softirq() && curr != this_cpu_ksoftirqd())
- per_cpu(cpu_softirq_time, cpu) += delta;
+ this_cpu_add(cpu_softirq_time, delta);

local_irq_restore(flags);
}
--
1.7.1

--
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/