Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756435Ab2FZMQU (ORCPT ); Tue, 26 Jun 2012 08:16:20 -0400 Received: from merlin.infradead.org ([205.233.59.134]:43993 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754298Ab2FZMQT convert rfc822-to-8bit (ORCPT ); Tue, 26 Jun 2012 08:16:19 -0400 Message-ID: <1340712949.21991.57.camel@twins> Subject: Re: [PATCH v4 12/13] fair.c: Use generic rbtree impl in fair scheduler From: Peter Zijlstra To: Daniel Santos Cc: Andrew Morton , Christopher Li , David Daney , David Howells , David Rientjes , Hidetoshi Seto , "H. Peter Anvin" , Ingo Molnar , Ingo Molnar , Joe Perches , Konstantin Khlebnikov , linux-doc@vger.kernel.org, linux-sparse@vger.kernel.org, LKML , Paul Gortmaker , Paul Turner , Pavel Pisa , Richard Weinberger , Rob Landley , Steven Rostedt , Suresh Siddha Date: Tue, 26 Jun 2012 14:15:49 +0200 In-Reply-To: <1340424048-7759-13-git-send-email-daniel.santos@pobox.com> References: <1340424048-7759-1-git-send-email-daniel.santos@pobox.com> <1340424048-7759-13-git-send-email-daniel.santos@pobox.com> Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7BIT X-Mailer: Evolution 3.2.2- Mime-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 906 Lines: 25 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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/