From patchwork Fri Nov 7 14:31:25 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 40410 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f72.google.com (mail-ee0-f72.google.com [74.125.83.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id CBCAA240F7 for ; Fri, 7 Nov 2014 14:31:46 +0000 (UTC) Received: by mail-ee0-f72.google.com with SMTP id d17sf3448250eek.3 for ; Fri, 07 Nov 2014 06:31:46 -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:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=5DDqCbwROQC7bA2pUZWK7vtbXrdYehhAYZEDA8czTio=; b=K+z6R/87NdKstoHSAEi3U5ty7YklishmB/oSa3qJ7sagmvS+MEGPe+9gweXW+XSHEl +YGghtTj7OwWvcZTBPZi9UqzdNL37o9sWZZKWak43gWbzrTZCq97x8ZoXG5fucEHMYfI DVmEKhiV00fJIVqu17XW2UMed0xS5U4hAHWSqYyDwc9eyCJIS4oV5IDZHm1Fdi7b8x3I sfDx4D6hWshi3Kdl2ItlH14v2MNLWzgmwLUbwPG2kBxTi4Z5Tq7+dF0SB9W/+4gZV1Wd pfreglaQmapFoblc/LOajYM0DzIZNfpJ0ERwue++h2qLqUw+JRfZyuSp/9lofM2OBOsp x/Cg== X-Gm-Message-State: ALoCoQkvxU+IdjxNKyppt0z1dHz1Ky+FAucE1CIGKG2wlzl2oZfJHQRmFmZWUE4qRe9TS4XnJAyn X-Received: by 10.194.91.180 with SMTP id cf20mr489132wjb.4.1415370706075; Fri, 07 Nov 2014 06:31:46 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.29.170 with SMTP id l10ls182974lah.18.gmail; Fri, 07 Nov 2014 06:31:45 -0800 (PST) X-Received: by 10.152.22.194 with SMTP id g2mr11528342laf.33.1415370705786; Fri, 07 Nov 2014 06:31:45 -0800 (PST) Received: from mail-la0-f53.google.com (mail-la0-f53.google.com. [209.85.215.53]) by mx.google.com with ESMTPS id o10si15221083lae.87.2014.11.07.06.31.45 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 07 Nov 2014 06:31:45 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.53 as permitted sender) client-ip=209.85.215.53; Received: by mail-la0-f53.google.com with SMTP id mc6so4404405lab.40 for ; Fri, 07 Nov 2014 06:31:45 -0800 (PST) X-Received: by 10.152.116.102 with SMTP id jv6mr5925423lab.40.1415370705682; Fri, 07 Nov 2014 06:31:45 -0800 (PST) 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.184.201 with SMTP id ew9csp206766lbc; Fri, 7 Nov 2014 06:31:45 -0800 (PST) X-Received: by 10.194.60.16 with SMTP id d16mr17069049wjr.13.1415370704002; Fri, 07 Nov 2014 06:31:44 -0800 (PST) Received: from mail-wg0-f49.google.com (mail-wg0-f49.google.com. [74.125.82.49]) by mx.google.com with ESMTPS id mb2si15688493wjb.3.2014.11.07.06.31.43 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 07 Nov 2014 06:31:43 -0800 (PST) Received-SPF: pass (google.com: domain of daniel.lezcano@linaro.org designates 74.125.82.49 as permitted sender) client-ip=74.125.82.49; Received: by mail-wg0-f49.google.com with SMTP id x13so3828452wgg.22 for ; Fri, 07 Nov 2014 06:31:43 -0800 (PST) X-Received: by 10.180.36.205 with SMTP id s13mr5466814wij.11.1415370703465; Fri, 07 Nov 2014 06:31:43 -0800 (PST) Received: from localhost.localdomain (AToulouse-656-1-898-91.w109-223.abo.wanadoo.fr. [109.223.3.91]) by mx.google.com with ESMTPSA id bl9sm2231926wib.24.2014.11.07.06.31.41 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 07 Nov 2014 06:31:42 -0800 (PST) From: Daniel Lezcano To: rjw@rjwysocki.net Cc: preeti@linux.vnet.ibm.com, 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, lenb@kernel.org Subject: [PATCH V3 4/6] cpuidle: idle: menu: Don't reflect when a state selection failed Date: Fri, 7 Nov 2014 15:31:25 +0100 Message-Id: <1415370687-18688-5-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1415370687-18688-1-git-send-email-daniel.lezcano@linaro.org> References: <1415370687-18688-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.215.53 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 Reviewed-by: Preeti U. Murthy --- drivers/cpuidle/governors/ladder.c | 3 +-- drivers/cpuidle/governors/menu.c | 3 +-- kernel/sched/idle.c | 3 ++- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/cpuidle/governors/ladder.c b/drivers/cpuidle/governors/ladder.c index 51c9ccd..86e4d49 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 = this_cpu_ptr(&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 91b3000..2e4a315 100644 --- a/drivers/cpuidle/governors/menu.c +++ b/drivers/cpuidle/governors/menu.c @@ -366,8 +366,7 @@ static void menu_reflect(struct cpuidle_device *dev, int index) { struct menu_device *data = this_cpu_ptr(&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 0a7a1d1..0ae1cc8 100644 --- a/kernel/sched/idle.c +++ b/kernel/sched/idle.c @@ -173,7 +173,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();