Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756218Ab2BOXhX (ORCPT ); Wed, 15 Feb 2012 18:37:23 -0500 Received: from merlin.infradead.org ([205.233.59.134]:33286 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752458Ab2BOXhW convert rfc822-to-8bit (ORCPT ); Wed, 15 Feb 2012 18:37:22 -0500 Message-ID: <1329349028.2293.190.camel@twins> Subject: Re: [RFC PATCH 01/14] sched: track the runnable average on a per-task entitiy basis From: Peter Zijlstra To: Paul Turner Cc: linux-kernel@vger.kernel.org, Venki Pallipadi , Srivatsa Vaddagiri , Mike Galbraith , Kamalesh Babulal , Ben Segall , Ingo Molnar , Vaidyanathan Srinivasan Date: Thu, 16 Feb 2012 00:37:08 +0100 In-Reply-To: <20120202013826.20844.8708.stgit@kitami.mtv.corp.google.com> References: <20120202013825.20844.26081.stgit@kitami.mtv.corp.google.com> <20120202013826.20844.8708.stgit@kitami.mtv.corp.google.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: 1247 Lines: 38 On Wed, 2012-02-01 at 17:38 -0800, Paul Turner wrote: > + /* > + * Use 1024us as the unit of measurement since it's a reasonable > + * approximation of 1ms and fast to compute. > + */ > + delta >>= 10; ns -> us ?, text talks about ms, slightly confusing > + if (!delta) > + return 0; > + sa->last_runnable_update = now; > + > + delta_w = sa->runnable_avg_period % 1024; so delta_w is the chunk of this p we already accounted. > + if (delta + delta_w >= 1024) { if delta pushes us over 1024*1024 ns (~1ms) we roll a window. > + /* period roll-over */ > + decayed = 1; > + > + delta_w = 1024 - delta_w; The distance we need to reach the next window. > + BUG_ON(delta_w > delta); somehow reading this code took forever, this suggests clarification, either through better variable names or more comments. Could also mean I'm a moron and should get more sleep or so :-) -- 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/