From patchwork Thu Jun 9 03:08:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhaoyang Huang X-Patchwork-Id: 69695 Delivered-To: patch@linaro.org Received: by 10.140.106.246 with SMTP id e109csp112211qgf; Wed, 8 Jun 2016 20:10:07 -0700 (PDT) X-Received: by 10.36.74.199 with SMTP id k190mr14369165itb.36.1465441806946; Wed, 08 Jun 2016 20:10:06 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id gk6si4911853pac.121.2016.06.08.20.10.06; Wed, 08 Jun 2016 20:10:06 -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 S933912AbcFIDJu (ORCPT + 14 others); Wed, 8 Jun 2016 23:09:50 -0400 Received: from mail-pf0-f169.google.com ([209.85.192.169]:34856 "EHLO mail-pf0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933858AbcFIDJs (ORCPT ); Wed, 8 Jun 2016 23:09:48 -0400 Received: by mail-pf0-f169.google.com with SMTP id c2so8690696pfa.2 for ; Wed, 08 Jun 2016 20:09:48 -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=HIr264Z4vWoB58w1L5Nl9nFM3IH1L/tVFd8Dw0a+1cY7keDzwlEIeYubOhP3WzLli6 E4QTLBG+bkLnfBM6/lH8NPhu8S8hnJ17SbvogilOoNb92NLVZIPLe5ZqWvOKvJoIqC7O PoNsjJ0TVAWohvDAYI1mKQVEOdvCcYrcKTlHs= 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=ID/JGkjGzcR/r7tDaTpwLWW0b/TOlths3wXV71kVNvTHmvI4zRZJS+n7OXxFhYA2qD Hd5zJLUEzxMOD0TptwUTVpipZJKBW2PgmOSY8swGnzC7CHpc13p4f8UMJ/WS9+TOOeko QjDTiqtadVlZX6NvkO3eIGukR63mEki3Ml5WMV4dvSgQbWvfEsiqA7ZD0Yo2ecZz2/E8 gFzqs9IKz/ds397Z8GK0I9yTZCoLxLPX3oOKcaJ5q7WuN/KSlniuCg2foQHAnaR6it4t 7V+/HGS2OFmlVhDlUCy1ZTEMiZ6DmjrUrTdICgja+sjV+zfas58OnNixOJW1AMntxuS7 AMlg== X-Gm-Message-State: ALyK8tLDmrmwCzgcRRTPPYvbIH06Y0CmbmIf5BYwwVfpTcoeevc6gjkoMF8OnzOv1ntcJsif X-Received: by 10.98.35.10 with SMTP id j10mr2149626pfj.10.1465441787429; Wed, 08 Jun 2016 20:09:47 -0700 (PDT) Received: from zyhuangubtpc.spreadtrum.com ([175.111.195.49]) by smtp.gmail.com with ESMTPSA id a17sm5472417pfa.70.2016.06.08.20.09.45 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 08 Jun 2016 20:09:47 -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 Subject: [RFC PATCH] power/cpuidle: enhance the precision of state select Date: Thu, 9 Jun 2016 11:08:40 +0800 Message-Id: <1465441720-5527-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: