Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757137Ab1EKQkT (ORCPT ); Wed, 11 May 2011 12:40:19 -0400 Received: from casper.infradead.org ([85.118.1.10]:49027 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756864Ab1EKQkE (ORCPT ); Wed, 11 May 2011 12:40:04 -0400 Subject: Re: [PATCH] sched: fix/optimise calculation of weight-inverse From: Peter Zijlstra To: Ingo Molnar Cc: Stephan =?ISO-8859-1?Q?B=E4rwolf?= , Linus Torvalds , Nikhil Rao , Mike Galbraith , "Nikunj A. Dadhania" , Srivatsa Vaddagiri , linux-kernel@vger.kernel.org In-Reply-To: <20110511162030.GA2638@elte.hu> References: <4DCAB351.4010204@tu-ilmenau.de> <20110511162030.GA2638@elte.hu> Content-Type: text/plain; charset="UTF-8" Date: Wed, 11 May 2011 18:43:05 +0200 Message-ID: <1305132185.2914.251.camel@laptop> Mime-Version: 1.0 X-Mailer: Evolution 2.30.3 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 848 Lines: 23 On Wed, 2011-05-11 at 18:20 +0200, Ingo Molnar wrote: > > - lw->inv_weight = 1 + (WMULT_CONST-lw->weight/2) > > - / (lw->weight+1); > > + lw->inv_weight = WMULT_CONST / lw->weight; > > hm, i definitely think there was a rounding reason for that - but apparently > i'm an idiot who does not add comments to non-obvious code! :-) I suspect I might be the idiot, > Peter, do you remember this? I think what we wanted to do was minimize the error: err = weight - inv*WMULT_CONST by adding another term. But we could well have simply made a mess of it instead. -- 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/