Re: [RFC] Merge softirq, local_irq_count, local_bh_count

From: Jamie Lokier (lk@tantalophile.demon.co.uk)
Date: Fri Jul 28 2000 - 12:53:21 EST


Russell King wrote:
> > Except for the places where cpu is a variable instead of
> > smp_processor_id(), those places might generate array access code.
>
> They shouldn't do - GCC should realise that code like:
>
> int this_cpu = 0;
>
> array_access[this_cpu].foo = 0;
> array_access[this_cpu].bar = 1;
>
> can be optimised. So long as "this_cpu" remains an auto variable, then
> it should be ok.

This is generally true, though there are a few situations where x86 GCC
makes some decisions about which instruction pattern to use before it
realises that `this_cpu' is constant. It probably makes no difference
in this example.

Of course, it knows the array has only one element so in principle it
could always just optimise away the index ;-)

-- Jamie

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Jul 31 2000 - 21:00:27 EST