[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1340712949.21991.57.camel@twins>
Date: Tue, 26 Jun 2012 14:15:49 +0200
From: Peter Zijlstra <a.p.zijlstra@...llo.nl>
To: Daniel Santos <daniel.santos@...ox.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Christopher Li <sparse@...isli.org>,
David Daney <david.daney@...ium.com>,
David Howells <dhowells@...hat.com>,
David Rientjes <rientjes@...gle.com>,
Hidetoshi Seto <seto.hidetoshi@...fujitsu.com>,
"H. Peter Anvin" <hpa@...or.com>, Ingo Molnar <mingo@...e.hu>,
Ingo Molnar <mingo@...nel.org>, Joe Perches <joe@...ches.com>,
Konstantin Khlebnikov <khlebnikov@...nvz.org>,
linux-doc@...r.kernel.org, linux-sparse@...r.kernel.org,
LKML <linux-kernel@...r.kernel.org>,
Paul Gortmaker <paul.gortmaker@...driver.com>,
Paul Turner <pjt@...gle.com>,
Pavel Pisa <pisa@....felk.cvut.cz>,
Richard Weinberger <richard@....at>,
Rob Landley <rob@...dley.net>,
Steven Rostedt <rostedt@...dmis.org>,
Suresh Siddha <suresh.b.siddha@...el.com>
Subject: Re: [PATCH v4 12/13] fair.c: Use generic rbtree impl in fair
scheduler
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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists