From patchwork Tue Apr 22 12:38:04 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chander Kashyap X-Patchwork-Id: 28775 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f72.google.com (mail-oa0-f72.google.com [209.85.219.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 4F89620341 for ; Tue, 22 Apr 2014 12:38:22 +0000 (UTC) Received: by mail-oa0-f72.google.com with SMTP id eb12sf34401999oac.7 for ; Tue, 22 Apr 2014 05:38:21 -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:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=WgRzoqiINHzhV1TYE+9MTESG2NU7X4jYNRQ1OQiOM2Q=; b=MGoLyPjbW6V8B/njlBpZCvo3V4KraU17ASA0pX9LHcIUNb0wic0VfG/6D6nbhe7kSO rOICBZua6XZBcWU/2XKxjic7UTpeiiU7MXAJIbAVpbxd7fBq4fvcUAYje19x/tUUpuuY MF3TNTgmRrBmhXc+sQyoKwY0IMnnkcFCMgarUZjyn9w7d1nciuslBqwB0DvO6QHHpzJw h0R3DKGZr9OaO7IISGYxqEiLJxRWyyRm3AqYDvU6ZfNfvWl05lekQpezCEPAvQioCbQa ZrkpfR6OyDdAc9GE7M/Rs5NDyDL7znqtgRskCYwlkjtuJJIixOWR658P1oTQc7s0at9R iP3Q== X-Gm-Message-State: ALoCoQnsGdDoqGYprKIPsXMGzD23RACKk5AWXrCMAsmmx69g2jpDq+imqh4OnDJXn63DWxQcx8L+ X-Received: by 10.182.186.103 with SMTP id fj7mr17036798obc.9.1398170301727; Tue, 22 Apr 2014 05:38:21 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.40.74 with SMTP id w68ls72070qgw.53.gmail; Tue, 22 Apr 2014 05:38:21 -0700 (PDT) X-Received: by 10.52.104.72 with SMTP id gc8mr18849vdb.48.1398170301541; Tue, 22 Apr 2014 05:38:21 -0700 (PDT) Received: from mail-ve0-f176.google.com (mail-ve0-f176.google.com [209.85.128.176]) by mx.google.com with ESMTPS id k4si6870023vcv.204.2014.04.22.05.38.21 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 22 Apr 2014 05:38:21 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.176 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.176; Received: by mail-ve0-f176.google.com with SMTP id db11so9479710veb.35 for ; Tue, 22 Apr 2014 05:38:21 -0700 (PDT) X-Received: by 10.220.92.193 with SMTP id s1mr416660vcm.34.1398170301382; Tue, 22 Apr 2014 05:38:21 -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 ib8csp21274vcb; Tue, 22 Apr 2014 05:38:20 -0700 (PDT) X-Received: by 10.66.122.101 with SMTP id lr5mr9216912pab.130.1398170300587; Tue, 22 Apr 2014 05:38:20 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id xf3si19539383pab.343.2014.04.22.05.38.19; Tue, 22 Apr 2014 05:38:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-pm-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 S1755775AbaDVMiS (ORCPT + 12 others); Tue, 22 Apr 2014 08:38:18 -0400 Received: from mail-pb0-f48.google.com ([209.85.160.48]:35301 "EHLO mail-pb0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751942AbaDVMiR (ORCPT ); Tue, 22 Apr 2014 08:38:17 -0400 Received: by mail-pb0-f48.google.com with SMTP id md12so4881128pbc.7 for ; Tue, 22 Apr 2014 05:38:17 -0700 (PDT) X-Received: by 10.66.164.165 with SMTP id yr5mr43829286pab.63.1398170297563; Tue, 22 Apr 2014 05:38:17 -0700 (PDT) Received: from localhost.localdomain ([115.113.119.130]) by mx.google.com with ESMTPSA id pq3sm84686276pbb.57.2014.04.22.05.38.14 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 22 Apr 2014 05:38:17 -0700 (PDT) From: Chander Kashyap To: rjw@rjwysocki.net Cc: tuukka.tikkanen@linaro.org, rafael.j.wysocki@intel.com, daniel.lezcano@linaro.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Chander Kashyap Subject: [RESEND][PATCH] cpuidle: governor: menu: move repeated correction factor check to init Date: Tue, 22 Apr 2014 18:08:04 +0530 Message-Id: <1398170284-7551-1-git-send-email-chander.kashyap@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: Sender: linux-pm-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-pm@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.128.176 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 71b5232..9b7918c 100644 --- a/drivers/cpuidle/governors/menu.c +++ b/drivers/cpuidle/governors/menu.c @@ -311,13 +311,6 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev) data->bucket = which_bucket(data->next_timer_us); /* - * 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. @@ -466,9 +459,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; }