summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2003-07-06 23:01:42 -0700
committerSteve French <cifs.adm@hostme.bitkeeper.com>2003-07-06 23:01:42 -0700
commitb993be7e4517f328fd6bd8bcea2f038c894a292e (patch)
tree5c57830158cec1d40c81b85e23353bad4647184d /kernel
parent163feb5818080346b1e819ca8f8fcd68eac5e593 (diff)
[PATCH] Make kstat_this_cpu in terms of __get_cpu_var and use it
kstat_this_cpu() is defined in terms of per_cpu instead of __get_cpu_var. This patch changes that, and uses it everywhere appropriate. The sched.c change puts it in a local variable, which helps gcc generate better code.
Diffstat (limited to 'kernel')
-rw-r--r--kernel/sched.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/kernel/sched.c b/kernel/sched.c
index 4f3d1fa42669..a4305315afda 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -1175,6 +1175,7 @@ DEFINE_PER_CPU(struct kernel_stat, kstat) = { { 0 } };
void scheduler_tick(int user_ticks, int sys_ticks)
{
int cpu = smp_processor_id();
+ struct cpu_usage_stat *cpustat = &kstat_this_cpu.cpustat;
runqueue_t *rq = this_rq();
task_t *p = current;
@@ -1184,19 +1185,19 @@ void scheduler_tick(int user_ticks, int sys_ticks)
if (p == rq->idle) {
/* note: this timer irq context must be accounted for as well */
if (irq_count() - HARDIRQ_OFFSET >= SOFTIRQ_OFFSET)
- kstat_cpu(cpu).cpustat.system += sys_ticks;
+ cpustat->system += sys_ticks;
else if (atomic_read(&rq->nr_iowait) > 0)
- kstat_cpu(cpu).cpustat.iowait += sys_ticks;
+ cpustat->iowait += sys_ticks;
else
- kstat_cpu(cpu).cpustat.idle += sys_ticks;
+ cpustat->idle += sys_ticks;
rebalance_tick(rq, 1);
return;
}
if (TASK_NICE(p) > 0)
- kstat_cpu(cpu).cpustat.nice += user_ticks;
+ cpustat->nice += user_ticks;
else
- kstat_cpu(cpu).cpustat.user += user_ticks;
- kstat_cpu(cpu).cpustat.system += sys_ticks;
+ cpustat->user += user_ticks;
+ cpustat->system += sys_ticks;
/* Task might have expired already, but not scheduled off yet */
if (p->array != rq->active) {