Re: [GIT pull] time(r) fixes for .25

From: Adrian Bunk
Date: Mon Mar 10 2008 - 15:38:43 EST


On Mon, Mar 10, 2008 at 05:44:07PM +0100, Pavel Machek wrote:
>
> > @@ -174,6 +174,10 @@ static inline void timespec_add_ns(struct timespec *a, u64 ns)
> > {
> > ns += a->tv_nsec;
> > while(unlikely(ns >= NSEC_PER_SEC)) {
> > + /* The following asm() prevents the compiler from
> > + * optimising this loop into a modulo operation. */
> > + asm("" : "+r"(ns));
> > +
>
> optimizing -> pessimizing or "optimizing" or explain that "optimized"
> version is slower than real version?
>...

In this case it's actually gcc's fault to ignore the unlikely(), so the
optimization would have made the code slower at least on some
architectures.

But more important, it resulted in build errors on i386 and some other
32bit architectures.

The underlying (and unresolved) issue is that gcc expects libgcc to be
available while the kernel does not link with libgcc on many platforms.

> Pavel

cu
Adrian

--

"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed

--
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/