Re: Performance tweaks

From: Mitchell Blank Jr (mitch@sfgoth.com)
Date: Thu Feb 24 2000 - 12:25:42 EST


Andrew Morton wrote:
> 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

-Mitch

-
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