From patchwork Fri Jun 17 09:13:35 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhaoyang Huang X-Patchwork-Id: 70295 Delivered-To: patch@linaro.org Received: by 10.140.28.4 with SMTP id 4csp179558qgy; Fri, 17 Jun 2016 02:13:49 -0700 (PDT) X-Received: by 10.36.149.4 with SMTP id m4mr33766159itd.94.1466154829296; Fri, 17 Jun 2016 02:13:49 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w9si19633649paz.164.2016.06.17.02.13.48; Fri, 17 Jun 2016 02:13:49 -0700 (PDT) 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; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751711AbcFQJNr (ORCPT + 14 others); Fri, 17 Jun 2016 05:13:47 -0400 Received: from mail-pa0-f43.google.com ([209.85.220.43]:34927 "EHLO mail-pa0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752665AbcFQJNq (ORCPT ); Fri, 17 Jun 2016 05:13:46 -0400 Received: by mail-pa0-f43.google.com with SMTP id hl6so26858727pac.2 for ; Fri, 17 Jun 2016 02:13:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id; bh=FiVUyJIp9PwP5KST8suPZliHBns9Vbj0qbLGMS9U5q4=; b=LQMeEixkPQ967/SzV4VIMHItcco2C5pN55mTQI4hBKyQk8OYbP+ejuZ82luHK7Oagi k1mQTqSn3yVjgybUIor9nE5hafem1OIIUwCdwIqlDKGuoCpBhY6bsPzHXVR/BESXRi+X na7+ygeXSB033mwu8p7g+XR+qGf+4/3gYd3S8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id; bh=FiVUyJIp9PwP5KST8suPZliHBns9Vbj0qbLGMS9U5q4=; b=YA32Z7DdhEemrG6kGPblN9oCgwOJwGFxhuV0fUNCQqfWHsvsp8Mh65h7qK/JuAnHIG do1mnJy/+AsHLR/xkFurh+G54W+idQAlvdHvf5+2+PVVP0SS8aEZZcGfo/CeEwJ0YcyY DcqwephXkSrOg/06OeI70G9DlRmwKTemwlgjOJT1hh3iUYvFH/W31fB7/DV20peRywAb VJJ5pPDh9L5YaJGgCKiKV46p0jlIqh1DxmbwqWOoIYOxAxBPFVPwFa8VjozYhCdQExiN 2tB1es4RxQ9CTnFuzAib4Fn95KfiKK3GzG8+Bn3gRkuOQXplzNfvQinK9/e7y1dPVXP6 pl0g== X-Gm-Message-State: ALyK8tK62leb6dHGhM28xBY9Fu9mqgLe4cDLdIyfJqNv9zKHKsO0HWmeQ8EWf1TWQjzLSpfd X-Received: by 10.66.25.38 with SMTP id z6mr1341307paf.11.1466154825325; Fri, 17 Jun 2016 02:13:45 -0700 (PDT) Received: from bj03382pcu.spreadtrum.com ([175.111.195.49]) by smtp.gmail.com with ESMTPSA id 7sm37356841pfa.28.2016.06.17.02.13.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 17 Jun 2016 02:13:44 -0700 (PDT) From: Zhaoyang Huang X-Google-Original-From: Zhaoyang Huang To: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, mingo@redhat.com, peterz@infradead.org, zhaoyang.huang@spreadtrum.com, tglx@linutronix.de Subject: [RESEND PATCH v2 1/2] power/cpuidle: enhance the precision of state select Date: Fri, 17 Jun 2016 17:13:35 +0800 Message-Id: <1466154816-17900-1-git-send-email-zhaoyang.huang@spreadtrum.com> X-Mailer: git-send-email 1.7.9.5 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org In previous version, cpu_pm_enter is invoked after the governor select the state, which cause the executing time of cpu_pm_enter is included in the idle time. Moving it before the state selection. Signed-off-by: Zhaoyang Huang --- kernel/sched/idle.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/kernel/sched/idle.c b/kernel/sched/idle.c index bd12c6c..929da2e 100644 --- a/kernel/sched/idle.c +++ b/kernel/sched/idle.c @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include @@ -130,6 +131,7 @@ static void cpuidle_idle_call(void) struct cpuidle_device *dev = __this_cpu_read(cpuidle_devices); struct cpuidle_driver *drv = cpuidle_get_cpu_driver(dev); int next_state, entered_state; + int ret; /* * Check if the idle task must be rescheduled. If it is the @@ -174,12 +176,16 @@ static void cpuidle_idle_call(void) /* * Ask the cpuidle framework to choose a convenient idle state. */ - next_state = cpuidle_select(drv, dev); - entered_state = call_cpuidle(drv, dev, next_state); - /* - * Give the governor an opportunity to reflect on the outcome - */ - cpuidle_reflect(dev, entered_state); + ret = cpu_pm_enter(); + if (!ret) { + next_state = cpuidle_select(drv, dev); + entered_state = call_cpuidle(drv, dev, next_state); + cpu_pm_exit(); + /* + * Give the governor an opportunity to reflect on the outcome + */ + cpuidle_reflect(dev, entered_state); + } } exit_idle: