While in irq, who must be charged for a tick?

Eric Lemoine (Eric.Lemoine@ens-lyon.fr)
Thu, 1 Aug 2002 16:46:49 +0200


I don't understand why a tick is charged to the current process when the
timer interrupt occurs while in hardirq or softirq context. There's
great chance that the hardirq or softirq is not serving 'current'.

Here's what I would do:

--- kernel/timer.c.orig Thu Aug 1 16:08:36 2002
+++ kernel/timer.c Thu Aug 1 16:09:51 2002
@@ -582,7 +582,9 @@
int cpu = smp_processor_id(), system = user_tick ^ 1;

update_one_process(p, user_tick, system, cpu);
- if (p->pid) {
+ if (local_bh_count(cpu) || local_irq_count(cpu) > 1)
+ kstat.per_cpu_system[cpu] += system;
+ else if (p->pid) {
if (--p->counter <= 0) {
p->counter = 0;
p->need_resched = 1;
@@ -593,8 +595,7 @@
kstat.per_cpu_user[cpu] += user_tick;

kstat.per_cpu_system[cpu] += system;
- } else if (local_bh_count(cpu) || local_irq_count(cpu) > 1)
- kstat.per_cpu_system[cpu] += system;
+ }
}

/*

[This is against 2.4.18-vanilla]

I'm certainly missing the point here. Please tell me where I'm wrong.

THX.

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