lkml.org 
[lkml]   [2010]   [Oct]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 2/6] cleanup account_system_vtime with this_cpu_* -v1
Date
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@google.com>
---
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


\
 
 \ /
  Last update: 2010-10-26 00:33    [W:0.083 / U:1.024 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site