Re: [PATCH] i386: Fix softirq accounting with 4K stacks

From: Arjan van de Ven
Date: Sun Jun 25 2006 - 11:18:14 EST


On Sun, 2006-06-25 at 16:24 +0200, BjÃrn Steinbrink wrote:
> Copy the softirq bits in preempt_count from the current context into the
> hardirq context when using 4K stacks to make the softirq_count macro work
> correctly and thereby fix softirq cpu time accounting.
>
> Signed-off-by: BjÃrn Steinbrink <B.Steinbrink@xxxxxx>
>
> diff -Nurp a/arch/i386/kernel/irq.c b/arch/i386/kernel/irq.c
> --- a/arch/i386/kernel/irq.c 2006-03-20 06:53:29.000000000 +0100
> +++ b/arch/i386/kernel/irq.c 2006-06-25 15:49:52.000000000 +0200
> @@ -95,6 +95,14 @@ fastcall unsigned int do_IRQ(struct pt_r
> irqctx->tinfo.task = curctx->tinfo.task;
> irqctx->tinfo.previous_esp = current_stack_pointer;
>
> + /*
> + * Copy the softirq bits in preempt_count so that the
> + * softirq checks work in the hardirq context.
> + */
> + irqctx->tinfo.preempt_count =
> + irqctx->tinfo.preempt_count & ~SOFTIRQ_MASK |
> + curctx->tinfo.preempt_count & SOFTIRQ_MASK;
> +
> asm volatile(
> " xchgl %%ebx,%%esp \n"
> " call __do_IRQ \n"

Hi,

at first I got nervous about the asymmetry of this (eg why only do this
copying only on entry, and not a copy back on exit)... but then again
these bits shouldn't change so your patch is ok as is...
it's regrettable that we need to add this for the softirq accounting;
part of me wishes we would just count irq-vs-user time and be done with
it ;)


Acked-by: Arjan van de Ven <arjan@xxxxxxxxxxxxxxx>

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