lkml.org 
[lkml]   [2012]   [Jun]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v4 12/13] fair.c: Use generic rbtree impl in fair scheduler
From
Date
On Fri, 2012-06-22 at 23:00 -0500, Daniel Santos wrote:
> +static inline long compare_vruntime(u64 *a, u64 *b)
> +{
> +#if __BITS_PER_LONG >= 64
> + return (long)((s64)*a - (s64)*b);
> +#else
> +/* This is hacky, but is done to reduce instructions -- we wont use this for
> + * rbtree lookups, only inserts, and since our relationship is defined as
> + * non-unique, we only need to return positive if a > b and any other value
> + * means less than.
> + */
> + return (long)(*a > *b);
> +#endif
> +}

That's wrong.. suppose: a = 10, b = ULLONG_MAX - 10

In that case (s64)(a - b) = 20, however a > b is false.
And yes, vruntime wrap does happen.


\
 
 \ /
  Last update: 2012-06-26 15:01    [from the cache]
©2003-2011 Jasper Spaans