Re: delay_tsc(): inefficient delay loop (2.6.16-mm1)

From: Edgar Toernig
Date: Fri Mar 24 2006 - 12:35:02 EST


Andreas Mohr wrote:
>
> rdtscl(bclock);
> + /* offset with bclock to have very simple comparison below */
> + loops += bclock;
> do {
> rep_nop();
> rdtscl(now);
> - } while ((now-bclock) < loops);
> + } while (now < loops);
> }

Hehe, optimizing delay loops *g* But your optimization is
wrong. 'loops+bclock' and/or 'now' is likely to wrap around
and then the test condition becomes bogus.

Ciao, ET.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/