From patchwork Mon Feb 24 06:29:31 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tuukka Tikkanen X-Patchwork-Id: 25173 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qa0-f72.google.com (mail-qa0-f72.google.com [209.85.216.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 200752066C for ; Mon, 24 Feb 2014 07:47:12 +0000 (UTC) Received: by mail-qa0-f72.google.com with SMTP id f11sf8740069qae.7 for ; Sun, 23 Feb 2014 23:47:11 -0800 (PST) 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=lo+gVaz+/nHR+rNaZCRaaFWllm6r6d4VMmPp17BzBEY=; b=mtE0l4DboLHXxNr8vzjQZloVc+T61sqM0f4u1QGwNJ/yuRMeC43bGNcHX33EW9Bljz e9NphD3AwTMkv6z0I/NseFXsYqFAwZq1lKtv1TPDSma2BHEVucbqYlLPXHpV9guBJasv JTk2zwuuAYdqKV9bHY4mSye4Dt5CYO5psHREXnUIuO/+U91ZNdbMFPMnmbbACGHI1vcp XhKncjSCV2Mvh5iQsoUXnnbCQfI4xAg9TUIiXvlsYodsKURqHG11VS2OE1IBCMeTw/QB TrWJcbZSOiRL3fjHqVHvZTy7ZJEAi/DNwX2NenmCIbkAH8W5H8oo5JtBF/1aebDnvtq2 0+7Q== X-Gm-Message-State: ALoCoQmDONNYH0J7v+Sbhy5oXG+Ic3BuMHMtWWqJ+n7WcwkkupDakoxZIo10cXrBv+9agGUfzhkw X-Received: by 10.236.109.97 with SMTP id r61mr9023546yhg.24.1393228031927; Sun, 23 Feb 2014 23:47:11 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.31.139 with SMTP id f11ls1787986qgf.71.gmail; Sun, 23 Feb 2014 23:47:11 -0800 (PST) X-Received: by 10.52.166.9 with SMTP id zc9mr9772496vdb.16.1393228031804; Sun, 23 Feb 2014 23:47:11 -0800 (PST) Received: from mail-ve0-f175.google.com (mail-ve0-f175.google.com [209.85.128.175]) by mx.google.com with ESMTPS id xs6si5647668vec.2.2014.02.23.23.47.11 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 23 Feb 2014 23:47:11 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.175 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.175; Received: by mail-ve0-f175.google.com with SMTP id oy12so1063755veb.20 for ; Sun, 23 Feb 2014 23:47:11 -0800 (PST) X-Received: by 10.52.107.35 with SMTP id gz3mr9628487vdb.8.1393228031715; Sun, 23 Feb 2014 23:47:11 -0800 (PST) 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.174.196 with SMTP id u4csp43432vcz; Sun, 23 Feb 2014 23:47:11 -0800 (PST) X-Received: by 10.66.149.37 with SMTP id tx5mr12017236pab.81.1393228030896; Sun, 23 Feb 2014 23:47:10 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ap6si15835105pad.55.2014.02.23.23.47.10; Sun, 23 Feb 2014 23:47:10 -0800 (PST) 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 S1752084AbaBXHpv (ORCPT + 11 others); Mon, 24 Feb 2014 02:45:51 -0500 Received: from mx.mmd.net ([80.83.0.3]:55326 "EHLO mx.mmd.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752182AbaBXHpu (ORCPT ); Mon, 24 Feb 2014 02:45:50 -0500 Received: from istutuskone.tic0.net (verkonrikkoja.tic0.net [80.83.5.104]) by mx.mmd.net (Postfix) with ESMTP id 3DB07E23; Mon, 24 Feb 2014 09:26:25 +0200 (EET) From: Tuukka Tikkanen To: linux-pm@vger.kernel.org, rjw@rjwysocki.net Cc: daniel.lezcano@linaro.org, tuukka.tikkanen@linaro.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/7] Cpuidle: rename expected_us to next_timer_us in menu governor Date: Mon, 24 Feb 2014 08:29:31 +0200 Message-Id: <1393223377-5744-2-git-send-email-tuukka.tikkanen@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1393223377-5744-1-git-send-email-tuukka.tikkanen@linaro.org> References: <1393223377-5744-1-git-send-email-tuukka.tikkanen@linaro.org> 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: tuukka.tikkanen@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.175 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: , The field expected_us is used to store the time remaining until next timer expiry. The name is inaccurate, as we really do not expect all wakeups to be caused by timers. In addition, another field with a very similar name (predicted_us) is used to store the predicted time remaining until any wakeup source being active. This patch renames expected_us to next_timer_us in order to better reflect the contained information. Signed-off-by: Tuukka Tikkanen Acked-by: Nicolas Pitre Acked-by: Len Brown --- drivers/cpuidle/governors/menu.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c index cf7f2f0..e9a2a27 100644 --- a/drivers/cpuidle/governors/menu.c +++ b/drivers/cpuidle/governors/menu.c @@ -122,7 +122,7 @@ struct menu_device { int last_state_idx; int needs_update; - unsigned int expected_us; + unsigned int next_timer_us; unsigned int predicted_us; unsigned int exit_us; unsigned int bucket; @@ -257,7 +257,7 @@ again: stddev = int_sqrt(stddev); if (((avg > stddev * 6) && (divisor * 4 >= INTERVALS * 3)) || stddev <= 20) { - if (data->expected_us > avg) + if (data->next_timer_us > avg) data->predicted_us = avg; return; } @@ -306,11 +306,11 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev) /* determine the expected residency time, round up */ t = ktime_to_timespec(tick_nohz_get_sleep_length()); - data->expected_us = + data->next_timer_us = t.tv_sec * USEC_PER_SEC + t.tv_nsec / NSEC_PER_USEC; - data->bucket = which_bucket(data->expected_us); + data->bucket = which_bucket(data->next_timer_us); multiplier = performance_multiplier(); @@ -326,7 +326,7 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev) * operands are 32 bits. * Make sure to round up for half microseconds. */ - data->predicted_us = div_round64((uint64_t)data->expected_us * + data->predicted_us = div_round64((uint64_t)data->next_timer_us * data->correction_factor[data->bucket], RESOLUTION * DECAY); @@ -336,7 +336,7 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev) * We want to default to C1 (hlt), not to busy polling * unless the timer is happening really really soon. */ - if (data->expected_us > 5 && + if (data->next_timer_us > 5 && !drv->states[CPUIDLE_DRIVER_STATE_START].disabled && dev->states_usage[CPUIDLE_DRIVER_STATE_START].disable == 0) data->last_state_idx = CPUIDLE_DRIVER_STATE_START; @@ -401,7 +401,7 @@ static void menu_update(struct cpuidle_driver *drv, struct cpuidle_device *dev) * for the whole expected time. */ if (unlikely(!(target->flags & CPUIDLE_FLAG_TIME_VALID))) - last_idle_us = data->expected_us; + last_idle_us = data->next_timer_us; measured_us = last_idle_us; @@ -418,8 +418,8 @@ static void menu_update(struct cpuidle_driver *drv, struct cpuidle_device *dev) new_factor = data->correction_factor[data->bucket]; new_factor -= new_factor / DECAY; - if (data->expected_us > 0 && measured_us < MAX_INTERESTING) - new_factor += RESOLUTION * measured_us / data->expected_us; + if (data->next_timer_us > 0 && measured_us < MAX_INTERESTING) + new_factor += RESOLUTION * measured_us / data->next_timer_us; else /* * we were idle so long that we count it as a perfect