[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: UP/SMP difference in IRQ_STAT
On Thu, Dec 20, 2001 at 11:41:38AM +0000, John Levon wrote:
> On Wed, Dec 19, 2001 at 11:07:11AM +0530, Bharata B Rao wrote:
>
> > Please consider the following definitions from include/linux/irq_cpustat.h
> > --------------------------
> > #ifdef CONFIG_SMP
> > #define __IRQ_STAT(cpu, member) (irq_stat[cpu].member)
> > #else
> > #define __IRQ_STAT(cpu, member) ((void)(cpu), irq_stat[0].member)
> > #endif
>
> I can only assume this is for performance. cpu might not be constant to the compiler,
> so the first would still have an indirection overhead on UP. The second one, however,
> lets the compiler optimise as the value of cpu is discarded (assume its evaluation has
> not side effects that is ;)
If that is so, why not just
#define __IRQ_STAT(cpu, member) (irq_stat[0].member)
for UP, so that the macros like local_irq_count(cpu) can be used as Lvalue.
(I am concerned about not being able to use this as Lvalue in UP)
Regards,
Bharata.
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
IRC Channel: irc.openprojects.net / #kernelnewbies
Web Page: http://www.kernelnewbies.org/