Re: Performance tweaks

From: Thierry Vignaud (tvignaud@mandrakesoft.com)
Date: Thu Feb 24 2000 - 13:22:40 EST


Mitchell Blank Jr a écrit :

> > For uniprocessors this:
> >
> > const int cpu = smp_processor_id();
> > if (dev->xmit_lock_owner != cpu) {
> >
> > generates faster code than this:
> >
> > int cpu = smp_processor_id();
> > if (dev->xmit_lock_owner != cpu) {
>
> That's really odd, I would have assumed that gcc would have optomized
> the variable away, but your experiment indicates otherwise. Maybe we need
>
> #ifdef CONFIG_SMP
> typedef int processor_id_t;
> #else
> typedef const int processor_id_t;
> #endif

move the #ifdef/endif pair in includes is better. Maybe a __SMP as :
#ifdef CONFIG_SMP
        #define __SMP
#else
        #define __SMP const
#endif

-- 
MandrakeSoft          http://www.mandrakesoft.com/
	somewhere between the playstation and the super cray
			         	 --Thierry

- 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 : Tue Feb 29 2000 - 21:00:10 EST