From patchwork Thu Oct 23 09:01:19 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 39347 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D40AD20341 for ; Thu, 23 Oct 2014 09:01:28 +0000 (UTC) Received: by mail-wi0-f200.google.com with SMTP id bs8sf578869wib.11 for ; Thu, 23 Oct 2014 02:01:28 -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:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=Rfsd75Q2eZkWapqPh3oDTqZs7NzI2G6ufMyGaBJsR7k=; b=KcBZIcWOuTSBqJm0R+4YKMeEvzITGU5r5Dyu3CG4NmJVByhqzKYB5cPNT/K5z+1uDe 6xQIJfLrlq4ZPiYgUyodoWRXJ1UW5cHuhZHj6a6ATbdfnbvatZXArx5F9UrBnxRd6246 C6FYhaiZJp+1lA7YMBmJ3U5Oq56tNSWHGbntZSoqsixVMDjjkX9t8HB/TbHfpxHnAX8C 4lll5JORmYxvNofzFHWi7z3sZCyT8DRP23rbngfs56ewXa3dYfbfOpl29Bw6Ul2aHgP2 31UrWLJl4IoMEbjZ6F1eCUowEY/CiqY/Jks9qcI3HtCb2cML8SPmJn43b37ihIOKzRo6 v83Q== X-Gm-Message-State: ALoCoQlmelHOJPH8DkXk9u9UA5lMjNCb15t2mrrPwoQbqCuFaojejltUTLxREJSMCNX5kYP0S/S0 X-Received: by 10.112.225.135 with SMTP id rk7mr776436lbc.6.1414054888100; Thu, 23 Oct 2014 02:01:28 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.26.98 with SMTP id k2ls285371lag.15.gmail; Thu, 23 Oct 2014 02:01:27 -0700 (PDT) X-Received: by 10.152.28.101 with SMTP id a5mr3683626lah.52.1414054887831; Thu, 23 Oct 2014 02:01:27 -0700 (PDT) Received: from mail-lb0-f179.google.com (mail-lb0-f179.google.com. [209.85.217.179]) by mx.google.com with ESMTPS id bm5si1628647lbb.59.2014.10.23.02.01.27 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 23 Oct 2014 02:01:27 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.179 as permitted sender) client-ip=209.85.217.179; Received: by mail-lb0-f179.google.com with SMTP id l4so457483lbv.38 for ; Thu, 23 Oct 2014 02:01:27 -0700 (PDT) X-Received: by 10.153.8.164 with SMTP id dl4mr3522164lad.29.1414054887745; Thu, 23 Oct 2014 02:01:27 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.112.84.229 with SMTP id c5csp220614lbz; Thu, 23 Oct 2014 02:01:27 -0700 (PDT) X-Received: by 10.194.103.230 with SMTP id fz6mr3780856wjb.53.1414054887031; Thu, 23 Oct 2014 02:01:27 -0700 (PDT) Received: from mail-wi0-f182.google.com (mail-wi0-f182.google.com. [209.85.212.182]) by mx.google.com with ESMTPS id dv6si935317wib.45.2014.10.23.02.01.26 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 23 Oct 2014 02:01:27 -0700 (PDT) Received-SPF: pass (google.com: domain of daniel.lezcano@linaro.org designates 209.85.212.182 as permitted sender) client-ip=209.85.212.182; Received: by mail-wi0-f182.google.com with SMTP id bs8so1350503wib.3 for ; Thu, 23 Oct 2014 02:01:26 -0700 (PDT) X-Received: by 10.180.208.100 with SMTP id md4mr11534779wic.53.1414054886770; Thu, 23 Oct 2014 02:01:26 -0700 (PDT) Received: from localhost.localdomain (AToulouse-656-1-959-39.w90-50.abo.wanadoo.fr. [90.50.216.39]) by mx.google.com with ESMTPSA id ga7sm1845645wic.5.2014.10.23.02.01.25 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 23 Oct 2014 02:01:26 -0700 (PDT) From: Daniel Lezcano To: rjw@rjwysocki.net Cc: nicolas.pitre@linaro.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, peterz@infradead.org, linaro-kernel@lists.linaro.org, patches@linaro.org Subject: [PATCH V2 3/5] cpuidle: idle: menu: Don't reflect when a state selection failed Date: Thu, 23 Oct 2014 11:01:19 +0200 Message-Id: <1414054881-17713-3-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1414054881-17713-1-git-send-email-daniel.lezcano@linaro.org> References: <1414054881-17713-1-git-send-email-daniel.lezcano@linaro.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.217.179 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , In the current code, the check to reflect or not the outcoming state is done against the idle state which has been chosen and its value. Instead of doing a check in each of the reflect functions, just don't call reflect if something went wrong in the idle path. Signed-off-by: Daniel Lezcano Acked-by: Nicolas Pitre --- drivers/cpuidle/governors/ladder.c | 3 +-- drivers/cpuidle/governors/menu.c | 4 +--- kernel/sched/idle.c | 3 ++- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/cpuidle/governors/ladder.c b/drivers/cpuidle/governors/ladder.c index fb396d6..c0b36a8 100644 --- a/drivers/cpuidle/governors/ladder.c +++ b/drivers/cpuidle/governors/ladder.c @@ -165,8 +165,7 @@ static int ladder_enable_device(struct cpuidle_driver *drv, static void ladder_reflect(struct cpuidle_device *dev, int index) { struct ladder_device *ldev = &__get_cpu_var(ladder_devices); - if (index > 0) - ldev->last_state_idx = index; + ldev->last_state_idx = index; } static struct cpuidle_governor ladder_governor = { diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c index a17515f..3907301 100644 --- a/drivers/cpuidle/governors/menu.c +++ b/drivers/cpuidle/governors/menu.c @@ -365,9 +365,7 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev, static void menu_reflect(struct cpuidle_device *dev, int index) { struct menu_device *data = &__get_cpu_var(menu_devices); - data->last_state_idx = index; - if (index >= 0) - data->needs_update = 1; + data->needs_update = 1; } /** diff --git a/kernel/sched/idle.c b/kernel/sched/idle.c index 58c7522..49dcc7d 100644 --- a/kernel/sched/idle.c +++ b/kernel/sched/idle.c @@ -162,7 +162,8 @@ use_default: /* * Give the governor an opportunity to reflect on the outcome */ - cpuidle_reflect(dev, entered_state); + if (entered_state >= 0) + cpuidle_reflect(dev, entered_state); exit_idle: __current_set_polling();