Re: [PATCH RFC tip/core/rcu 13/20] rcu: increasesynchronize_sched_expedited() batching

From: Peter Zijlstra
Date: Mon Dec 20 2010 - 05:34:19 EST


On Sun, 2010-12-19 at 08:35 -0800, Paul E. McKenney wrote:
> > (int)((unsigned)(a) - (unsigned)(b)) < 0
>
> Unfortunately, no. :-(
>
> The (int) converts from unsigned to signed, and if the upper bit of
> the unsigned difference is non-zero, then the paragraph I quoted above
> applies, and the standard allows the compiler to do whatever it wants.
>
As noted in the previous reply, that would render quite a lot of our
time-keeping code broken. I think its safe to assume this works.

Look at time_after() for example:

#define time_after(a,b) \
(typecheck(unsigned long, a) && \
typecheck(unsigned long, b) && \
((long)(b) - (long)(a) < 0))

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