Re: [RFC] Merge softirq, local_irq_count, local_bh_count

From: Keith Owens (kaos@ocs.com.au)
Date: Thu Jul 27 2000 - 17:07:42 EST


On Thu, 27 Jul 2000 21:37:14 +0100 (BST),
Russell King <rmk@arm.linux.org.uk> wrote:
>Keith Owens writes:
>> ftp://ftp.ocs.com.au/pub/2.4.0-test5-pre6-softirq-bh-merge.gz is a
>> merge of softirq, local_irq_count and local_bh_count into one
>> structure. The aim was :-
>
>There appears to be some crud in there, particularly:
>
>+#ifdef CONFIG_SMP
>+irq_cpustat_t irq_stat[NR_CPUS];
>+#else
>+irq_cpustat_t irq_stat;
>+#endif
>
>Since:
>
> irq_cpustat_t irqstat[1];
>
>takes the same space as:
>
> irq_cpustat_t irqstat;
>
>In addition:
>
> smp_processor_id()
>
>on a non-SMP machine is:
>
> #define smp_processor_id() 0
>
>Removing all the #ifdef crud causes:
>
>1. No performance penalty
>2. No space penalty
>3. Makes the code easier to read

Except for the places where cpu is a variable instead of smp_processor_id(),
those places might generate array access code. I thought about using a
single set of macros and always defining irq_stat[NR_CPUS], trusting to
gcc to optimize the array access away for UP but decided to err on the
side of caution. As for readability, almost all the existing code
defines SMP and UP versions, at least this patch reduces to one
definition instead of one per arch with subtly different definitions.

-
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:24 EST