From patchwork Thu Apr 10 13:43:53 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chander Kashyap X-Patchwork-Id: 28189 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qg0-f72.google.com (mail-qg0-f72.google.com [209.85.192.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 916FC20671 for ; Thu, 10 Apr 2014 13:44:23 +0000 (UTC) Received: by mail-qg0-f72.google.com with SMTP id q108sf7404750qgd.11 for ; Thu, 10 Apr 2014 06:44:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=wMfIO4jXLz7oFXPtmpFrx6CBJn1gLSv2YFb+SiOsUHk=; b=CbGuWzAW6/6ob8hBVHdR6RR+L4mhLnQuGrDIyyFnqZJ6Qw6iowZqMHUB+O32FWM21F wP3OwpbyGjvjOMLnHGxdng+UJgvwP4rBF6Tb0kGjZecw3hI1iHZv9j6cJ6SM/7R+zG5m cTEOzUidom0FmKGO54F9pdu8MllLxoA68L9CNkBZZh20rgSp+OkYngn63nXZ4QO2nkgJ Ohw/orqaKYGDtBmDLspDXRANow0ABOM4bOFZo019v0izERrL0QvZSY3DjnHP/yaUG/44 dAg9NQ8Axs7TZ/VXhUAQK9Xsz3XV7MYHW1/7zPwrrTJPjSHiooE1Av00Cm0A2Fu6Sqvh xZGg== X-Gm-Message-State: ALoCoQnA/DJYGY9BRvkytzoVKgof5bOuC04foRHD0OVzjJq7E2W6IcSybw88QXF6UbuVHYFRQ08Z X-Received: by 10.58.112.97 with SMTP id ip1mr8323277veb.32.1397137463362; Thu, 10 Apr 2014 06:44:23 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.81.201 with SMTP id f67ls1085568qgd.91.gmail; Thu, 10 Apr 2014 06:44:23 -0700 (PDT) X-Received: by 10.52.0.193 with SMTP id 1mr12359647vdg.0.1397137463053; Thu, 10 Apr 2014 06:44:23 -0700 (PDT) Received: from mail-vc0-f177.google.com (mail-vc0-f177.google.com [209.85.220.177]) by mx.google.com with ESMTPS id sw4si700937vdc.30.2014.04.10.06.44.23 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 10 Apr 2014 06:44:23 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.177 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.177; Received: by mail-vc0-f177.google.com with SMTP id if17so3333545vcb.36 for ; Thu, 10 Apr 2014 06:44:23 -0700 (PDT) X-Received: by 10.58.201.5 with SMTP id jw5mr14056864vec.6.1397137462971; Thu, 10 Apr 2014 06:44:22 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp60622vcb; Thu, 10 Apr 2014 06:44:22 -0700 (PDT) X-Received: by 10.66.146.229 with SMTP id tf5mr20105175pab.50.1397137462271; Thu, 10 Apr 2014 06:44:22 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id pu9si2226014pbb.448.2014.04.10.06.44.21; Thu, 10 Apr 2014 06:44:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161058AbaDJNoJ (ORCPT + 27 others); Thu, 10 Apr 2014 09:44:09 -0400 Received: from mail-pb0-f54.google.com ([209.85.160.54]:47910 "EHLO mail-pb0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030816AbaDJNoH (ORCPT ); Thu, 10 Apr 2014 09:44:07 -0400 Received: by mail-pb0-f54.google.com with SMTP id ma3so3984567pbc.13 for ; Thu, 10 Apr 2014 06:44:07 -0700 (PDT) X-Received: by 10.68.198.97 with SMTP id jb1mr19630896pbc.104.1397137447093; Thu, 10 Apr 2014 06:44:07 -0700 (PDT) Received: from localhost.localdomain ([115.113.119.130]) by mx.google.com with ESMTPSA id xg4sm9245634pbb.47.2014.04.10.06.44.04 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 10 Apr 2014 06:44:06 -0700 (PDT) From: Chander Kashyap To: linux-kernel@vger.kernel.org Cc: rafael.j.wysocki@intel.com, tuukka.tikkanen@linaro.org, daniel.lezcano@linaro.org, Chander Kashyap Subject: [PATCH] cpuidle: governor: menu: move repeated correction factor check to init Date: Thu, 10 Apr 2014 19:13:53 +0530 Message-Id: <1397137433-19106-1-git-send-email-chander.kashyap@linaro.org> X-Mailer: git-send-email 1.7.9.5 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: chander.kashyap@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.177 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , In menu_select function we check for correction factor every time. If it is zero we are initializing to unity. Hence move it to init function and initialise by unity, hence avoid repeated comparisons. Signed-off-by: Chander Kashyap Reviewed-by: Tuukka Tikkanen --- drivers/cpuidle/governors/menu.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c index cf7f2f0..048f6d9 100644 --- a/drivers/cpuidle/governors/menu.c +++ b/drivers/cpuidle/governors/menu.c @@ -315,13 +315,6 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev) multiplier = performance_multiplier(); /* - * if the correction factor is 0 (eg first time init or cpu hotplug - * etc), we actually want to start out with a unity factor. - */ - if (data->correction_factor[data->bucket] == 0) - data->correction_factor[data->bucket] = RESOLUTION * DECAY; - - /* * Force the result of multiplication to be 64 bits even if both * operands are 32 bits. * Make sure to round up for half microseconds. @@ -453,9 +446,17 @@ static int menu_enable_device(struct cpuidle_driver *drv, struct cpuidle_device *dev) { struct menu_device *data = &per_cpu(menu_devices, dev->cpu); + int i; memset(data, 0, sizeof(struct menu_device)); + /* + * if the correction factor is 0 (eg first time init or cpu hotplug + * etc), we actually want to start out with a unity factor. + */ + for(i = 0; i < BUCKETS; i++) + data->correction_factor[i] = RESOLUTION * DECAY; + return 0; }