From patchwork Fri Nov 21 09:29:52 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 41292 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f70.google.com (mail-wg0-f70.google.com [74.125.82.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C5EA323C27 for ; Fri, 21 Nov 2014 09:30:12 +0000 (UTC) Received: by mail-wg0-f70.google.com with SMTP id b13sf2737050wgh.1 for ; Fri, 21 Nov 2014 01:30:12 -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=C79IuA0LRMwZEtDkLu+eomSQHsTtWEjDqB4Hbtce2Go=; b=kiOZ/oInnEB202+2kfoTARrXvbSd/2XlGxc7qA84KiUfYXhgQKG6VWMf1Yg2WiVUm6 HvTdFrcC7pA6CKP0/1GosVjvs+ldjA2XVZ102xjrAud24dzZfwaVB2I1/D90ttKOARPz 6hrTupImL9C63/pOOMoXU3QFOFdZZM10+5jA13mTRvCV2xJHYDZEEfo/AuFhiiXWaLPt uCS4f7knMEJ7GPVrZuJiq0w0c/VsgHlI9qOADWu+GvvDJEE5kDUdkBaCb1E5pbALGRJh AliTLLzOpHGAj7FRn4xnaCcFKwwzGW2xYI8QtpOdzUhLrsnHe7K83PI5rk8bBsAkKhUE CG/A== X-Gm-Message-State: ALoCoQmvJ7SYouefIoJpadJnA1nCGbb/bI5enxlFKOmfq0pxllmkxTDcIWM4CA5gMRbdTEMSjtn2 X-Received: by 10.180.19.42 with SMTP id b10mr636845wie.0.1416562210738; Fri, 21 Nov 2014 01:30:10 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.26.72 with SMTP id j8ls132390lag.105.gmail; Fri, 21 Nov 2014 01:30:10 -0800 (PST) X-Received: by 10.152.27.2 with SMTP id p2mr3068623lag.19.1416562210577; Fri, 21 Nov 2014 01:30:10 -0800 (PST) Received: from mail-la0-f46.google.com (mail-la0-f46.google.com. [209.85.215.46]) by mx.google.com with ESMTPS id xe3si4447082lbb.114.2014.11.21.01.30.10 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 21 Nov 2014 01:30:10 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.46 as permitted sender) client-ip=209.85.215.46; Received: by mail-la0-f46.google.com with SMTP id gd6so3950343lab.33 for ; Fri, 21 Nov 2014 01:30:10 -0800 (PST) X-Received: by 10.112.235.196 with SMTP id uo4mr3066786lbc.66.1416562210450; Fri, 21 Nov 2014 01:30:10 -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.112.184.201 with SMTP id ew9csp51956lbc; Fri, 21 Nov 2014 01:30:09 -0800 (PST) X-Received: by 10.70.133.72 with SMTP id pa8mr4930368pdb.59.1416562208445; Fri, 21 Nov 2014 01:30:08 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ye3si7208436pab.141.2014.11.21.01.30.07 for ; Fri, 21 Nov 2014 01:30:08 -0800 (PST) Received-SPF: none (google.com: linux-pm-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754753AbaKUJaG (ORCPT + 12 others); Fri, 21 Nov 2014 04:30:06 -0500 Received: from mail-wi0-f178.google.com ([209.85.212.178]:38385 "EHLO mail-wi0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754592AbaKUJaD (ORCPT ); Fri, 21 Nov 2014 04:30:03 -0500 Received: by mail-wi0-f178.google.com with SMTP id hi2so8101105wib.17 for ; Fri, 21 Nov 2014 01:29:59 -0800 (PST) X-Received: by 10.194.189.81 with SMTP id gg17mr5363549wjc.115.1416562198570; Fri, 21 Nov 2014 01:29:58 -0800 (PST) Received: from localhost.localdomain ([109.215.21.36]) by mx.google.com with ESMTPSA id pj4sm7259002wjb.16.2014.11.21.01.29.57 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 21 Nov 2014 01:29:58 -0800 (PST) From: Daniel Lezcano To: rjw@rjwysocki.net Cc: linux-pm@vger.kernel.org, linaro-kernel@lists.linaro.org, linux-acpi@vger.kernel.org Subject: [PATCH 2/2] cpuidle: Remove TIME_INVALID flag Date: Fri, 21 Nov 2014 10:29:52 +0100 Message-Id: <1416562192-14114-2-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1416562192-14114-1-git-send-email-daniel.lezcano@linaro.org> References: <1416562192-14114-1-git-send-email-daniel.lezcano@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: daniel.lezcano@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.46 as permitted sender) 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 time measurement is always valid for all the drivers for all the idle states. This flag is no longer needed. Remove it as well as the code using it. Signed-off-by: Daniel Lezcano --- drivers/cpuidle/governors/ladder.c | 8 ++------ drivers/cpuidle/governors/menu.c | 25 ++++++++----------------- include/linux/cpuidle.h | 2 -- 3 files changed, 10 insertions(+), 25 deletions(-) diff --git a/drivers/cpuidle/governors/ladder.c b/drivers/cpuidle/governors/ladder.c index 37263d9..55a1fc9 100644 --- a/drivers/cpuidle/governors/ladder.c +++ b/drivers/cpuidle/governors/ladder.c @@ -79,12 +79,8 @@ static int ladder_select_state(struct cpuidle_driver *drv, last_state = &ldev->states[last_idx]; - if (!(drv->states[last_idx].flags & CPUIDLE_FLAG_TIME_INVALID)) { - last_residency = cpuidle_get_last_residency(dev) - \ - drv->states[last_idx].exit_latency; - } - else - last_residency = last_state->threshold.promotion_time + 1; + last_residency = cpuidle_get_last_residency(dev) - \ + drv->states[last_idx].exit_latency; /* consider promotion */ if (last_idx < drv->state_count - 1 && diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c index 659d7b0..2191ea0 100644 --- a/drivers/cpuidle/governors/menu.c +++ b/drivers/cpuidle/governors/menu.c @@ -395,32 +395,23 @@ static void menu_update(struct cpuidle_driver *drv, struct cpuidle_device *dev) * Try to figure out how much time passed between entry to low * power state and occurrence of the wakeup event. * - * If the entered idle state didn't support residency measurements, - * we are basically lost in the dark how much time passed. - * As a compromise, assume we slept for the whole expected time. - * * Any measured amount of time will include the exit latency. * Since we are interested in when the wakeup begun, not when it * was completed, we must subtract the exit latency. However, if * the measured amount of time is less than the exit latency, * assume the state was never reached and the exit latency is 0. */ - if (unlikely(target->flags & CPUIDLE_FLAG_TIME_INVALID)) { - /* Use timer value as is */ - measured_us = data->next_timer_us; - } else { - /* Use measured value */ - measured_us = cpuidle_get_last_residency(dev); + /* Use measured value */ + measured_us = cpuidle_get_last_residency(dev); - /* Deduct exit latency */ - if (measured_us > target->exit_latency) - measured_us -= target->exit_latency; + /* Deduct exit latency */ + if (measured_us > target->exit_latency) + measured_us -= target->exit_latency; - /* Make sure our coefficients do not exceed unity */ - if (measured_us > data->next_timer_us) - measured_us = data->next_timer_us; - } + /* Make sure our coefficients do not exceed unity */ + if (measured_us > data->next_timer_us) + measured_us = data->next_timer_us; /* Update our correction ratio */ new_factor = data->correction_factor[data->bucket]; diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h index a07e087..d697b9e 100644 --- a/include/linux/cpuidle.h +++ b/include/linux/cpuidle.h @@ -53,7 +53,6 @@ struct cpuidle_state { }; /* Idle State Flags */ -#define CPUIDLE_FLAG_TIME_INVALID (0x01) /* is residency time measurable? */ #define CPUIDLE_FLAG_COUPLED (0x02) /* state applies to multiple cpus */ #define CPUIDLE_FLAG_TIMER_STOP (0x04) /* timer is stopped on this state */ @@ -90,7 +89,6 @@ DECLARE_PER_CPU(struct cpuidle_device, cpuidle_dev); * cpuidle_get_last_residency - retrieves the last state's residency time * @dev: the target CPU * - * NOTE: this value is invalid if CPUIDLE_FLAG_TIME_INVALID is set */ static inline int cpuidle_get_last_residency(struct cpuidle_device *dev) {