From patchwork Mon Feb 24 06:29:32 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tuukka Tikkanen X-Patchwork-Id: 25174 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yh0-f72.google.com (mail-yh0-f72.google.com [209.85.213.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 5C9152066C for ; Mon, 24 Feb 2014 07:48:03 +0000 (UTC) Received: by mail-yh0-f72.google.com with SMTP id f73sf9107831yha.11 for ; Sun, 23 Feb 2014 23:48:03 -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=EsJIKDjTVyNGEx7LW3OYbCdcbhgAk62EuSgYrwX//t4=; b=OLAZDLEVr2mbenTh1p9SHsYEnbm/h6n1e3Cj5/SqA8uxIXC/maEs+mlODVPhDe1TGq jRQgcHVy9H/iiRiOsv+q5Q5/euDAMYpGbAX65C6ml/+T1Ez5uNs45IYpfCm7jDtsMdil siioiZimZF1HzqAtGP0ZmiZ7PDwPXK4/ZGLu8cBE8iVeH+TAFSbYiZM87ShgqOf+rnV+ UmwsRBmuZS0bg3v5xM4w3C4hFO2XQuoUZQEMlZzbKEcK9S1FMSyVhXXOEbdCumWO/pH4 asZONirl5FMc4cHs/tfUgPS4GBj+8ouxK+ynaFUpU3rYaFNbKiaVZ7ZEU1xGzSKcaABK cGCQ== X-Gm-Message-State: ALoCoQlrkp0htmZ3d47xZiKEdX+RMMJbMvgWtDAQLQBYU3o2o1pH52z1UF7rIRIWGmTN87raYSVB X-Received: by 10.236.175.226 with SMTP id z62mr2004873yhl.47.1393228083149; Sun, 23 Feb 2014 23:48:03 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.95.134 with SMTP id i6ls1890184qge.2.gmail; Sun, 23 Feb 2014 23:48:03 -0800 (PST) X-Received: by 10.220.200.6 with SMTP id eu6mr11511396vcb.35.1393228083000; Sun, 23 Feb 2014 23:48:03 -0800 (PST) Received: from mail-ve0-f177.google.com (mail-ve0-f177.google.com [209.85.128.177]) by mx.google.com with ESMTPS id ru2si5630363vcb.104.2014.02.23.23.48.02 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 23 Feb 2014 23:48:02 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.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.128.177; Received: by mail-ve0-f177.google.com with SMTP id db12so4217893veb.36 for ; Sun, 23 Feb 2014 23:48:02 -0800 (PST) X-Received: by 10.220.192.71 with SMTP id dp7mr11586080vcb.45.1393228082933; Sun, 23 Feb 2014 23:48:02 -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 u4csp43473vcz; Sun, 23 Feb 2014 23:48:02 -0800 (PST) X-Received: by 10.66.142.132 with SMTP id rw4mr23989479pab.6.1393228081684; Sun, 23 Feb 2014 23:48:01 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l1si13362496pbn.353.2014.02.23.23.48.01; Sun, 23 Feb 2014 23:48:01 -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 S1751480AbaBXHsA (ORCPT + 11 others); Mon, 24 Feb 2014 02:48:00 -0500 Received: from mx.mmd.net ([80.83.0.3]:55337 "EHLO mx.mmd.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751200AbaBXHr7 (ORCPT ); Mon, 24 Feb 2014 02:47:59 -0500 Received: from istutuskone.tic0.net (verkonrikkoja.tic0.net [80.83.5.104]) by mx.mmd.net (Postfix) with ESMTP id C8652ED5; Mon, 24 Feb 2014 09:26:27 +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 2/7] Cpuidle: Use actual state latency in menu governor Date: Mon, 24 Feb 2014 08:29:32 +0200 Message-Id: <1393223377-5744-3-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.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: , Currently menu governor records the exit latency of the state it has chosen for the idle period. The stored latency value is then later used to calculate the actual length of the idle period. This value may however be incorrect, as the entered state may not be the one chosen by the governor. The entered state information is available, so we can use that to obtain the real exit latency. Signed-off-by: Tuukka Tikkanen Acked-by: Daniel Lezcano --- drivers/cpuidle/governors/menu.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c index e9a2a27..115386a 100644 --- a/drivers/cpuidle/governors/menu.c +++ b/drivers/cpuidle/governors/menu.c @@ -124,7 +124,6 @@ struct menu_device { unsigned int next_timer_us; unsigned int predicted_us; - unsigned int exit_us; unsigned int bucket; unsigned int correction_factor[BUCKETS]; unsigned int intervals[INTERVALS]; @@ -298,7 +297,6 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev) } data->last_state_idx = 0; - data->exit_us = 0; /* Special case when user has set very strict latency requirement */ if (unlikely(latency_req == 0)) @@ -359,7 +357,6 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev) continue; data->last_state_idx = i; - data->exit_us = s->exit_latency; } return data->last_state_idx; @@ -410,8 +407,8 @@ static void menu_update(struct cpuidle_driver *drv, struct cpuidle_device *dev) * We correct for the exit latency; we are assuming here that the * exit latency happens after the event that we're interested in. */ - if (measured_us > data->exit_us) - measured_us -= data->exit_us; + if (measured_us > target->exit_latency) + measured_us -= target->exit_latency; /* Update our correction ratio */