From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755012Ab2CNPB0 (ORCPT ); Wed, 14 Mar 2012 11:01:26 -0400 Received: from casper.infradead.org ([85.118.1.10]:57847 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751416Ab2CNPBZ convert rfc822-to-8bit (ORCPT ); Wed, 14 Mar 2012 11:01:25 -0400 Message-ID: <1331737268.18960.125.camel@twins> Subject: Re: [RFC PATCH 14/14] sched: implement usage tracking From: Peter Zijlstra To: Vincent Guittot Cc: Paul Turner , linux-kernel@vger.kernel.org, Venki Pallipadi , Srivatsa Vaddagiri , Mike Galbraith , Kamalesh Babulal , Ben Segall , Ingo Molnar , Vaidyanathan Srinivasan Date: Wed, 14 Mar 2012 16:01:08 +0100 In-Reply-To: References: <20120202013825.20844.26081.stgit@kitami.mtv.corp.google.com> <20120202013827.20844.49057.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 On Tue, 2012-03-13 at 17:57 +0100, Vincent Guittot wrote: > > struct sched_avg { > > u64 runnable_avg_sum, runnable_avg_period; > > u64 last_runnable_update, decay_count; > > + u32 usage_avg_sum; > > Why usage_avg_sum is 32bits whereas runnable_avg_sum and > runnable_avg_period are 64bits long ? You are doing the same > computation on these 3 variables. Only the computation need to be done > in 64bits but the result could be saved in 32bits ? Since you can never use more than 100% of cpu time, usage_avg_sum is bound to 100% of the period, which (assuming your period < ~4s) should thus still fit in the ~4s u32 provides. Runnable otoh is not bound by that and thus we cannot guarantee the value stays within the ~4s value range.