Re: [PATCH 1/5] 2.6.0 fix preempt ctx switch accounting

From: Ingo Molnar
Date: Sat Dec 20 2003 - 14:28:09 EST


* Nick Piggin <piggin@xxxxxxxxxxxxxxx> wrote:

> Make sure to count kernel preemption as a context switch. A short cut
> has been preventing it.

i'd prefer the much simpler patch below. This also keeps the kernel
preemption logic isolated instead of mixing it into the normal path.

Ingo

--- linux/kernel/sched.c.orig
+++ linux/kernel/sched.c
@@ -1520,8 +1520,10 @@ need_resched:
* if entering off of a kernel preemption go straight
* to picking the next task.
*/
- if (unlikely(preempt_count() & PREEMPT_ACTIVE))
+ if (unlikely(preempt_count() & PREEMPT_ACTIVE)) {
+ prev->nivcsw++;
goto pick_next_task;
+ }

switch (prev->state) {
case TASK_INTERRUPTIBLE:
-
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/