From patchwork Mon May 4 13:58:59 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rafael J. Wysocki" X-Patchwork-Id: 6326761 X-Patchwork-Delegate: rjw@sisk.pl Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 639A9BEEE1 for ; Mon, 4 May 2015 13:34:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F3A5020382 for ; Mon, 4 May 2015 13:34:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EE9F3202EB for ; Mon, 4 May 2015 13:34:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752522AbbEDNeI (ORCPT ); Mon, 4 May 2015 09:34:08 -0400 Received: from v094114.home.net.pl ([79.96.170.134]:59820 "HELO v094114.home.net.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1752494AbbEDNeI (ORCPT ); Mon, 4 May 2015 09:34:08 -0400 Received: from cmk84.neoplus.adsl.tpnet.pl (83.31.138.84) (HELO vostro.rjw.lan) by serwer1319399.home.pl (79.96.170.134) with SMTP (IdeaSmtpServer v0.80) id 6d9b8428cd200e92; Mon, 4 May 2015 15:34:06 +0200 From: "Rafael J. Wysocki" To: Peter Zijlstra Cc: Linux PM list , Linux Kernel Mailing List , Daniel Lezcano Subject: [PATCH 4/4] sched / idle: Call default_idle_call() from cpuidle_enter_state() Date: Mon, 04 May 2015 15:58:59 +0200 Message-ID: <3809765.j45t3RE71A@vostro.rjw.lan> User-Agent: KMail/4.11.5 (Linux/4.0.0+; KDE/4.11.5; x86_64; ; ) In-Reply-To: <3084951.QaIkFrZ3VU@vostro.rjw.lan> References: <3084951.QaIkFrZ3VU@vostro.rjw.lan> MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Rafael J. Wysocki The check of the cpuidle_enter() return value against -EBUSY made in call_cpuidle() will not be necessary any more if cpuidle_enter_state() calls default_idle_call() directly when it is about to return -EBUSY, so make that happen and eliminate the check. Signed-off-by: Rafael J. Wysocki --- drivers/cpuidle/cpuidle.c | 4 +++- drivers/cpuidle/cpuidle.h | 2 ++ kernel/sched/idle.c | 14 ++++++-------- 3 files changed, 11 insertions(+), 9 deletions(-) -- 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 Index: linux-pm/drivers/cpuidle/cpuidle.c =================================================================== --- linux-pm.orig/drivers/cpuidle/cpuidle.c +++ linux-pm/drivers/cpuidle/cpuidle.c @@ -167,8 +167,10 @@ int cpuidle_enter_state(struct cpuidle_d * local timer will be shut down. If a local timer is used from another * CPU as a broadcast timer, this call may fail if it is not available. */ - if (broadcast && tick_broadcast_enter()) + if (broadcast && tick_broadcast_enter()) { + default_idle_call(); return -EBUSY; + } trace_cpu_idle_rcuidle(index, dev->cpu); time_start = ktime_get(); Index: linux-pm/drivers/cpuidle/cpuidle.h =================================================================== --- linux-pm.orig/drivers/cpuidle/cpuidle.h +++ linux-pm/drivers/cpuidle/cpuidle.h @@ -18,6 +18,8 @@ extern int cpuidle_enter_state(struct cp /* idle loop */ extern void cpuidle_install_idle_handler(void); extern void cpuidle_uninstall_idle_handler(void); +/* kernel/sched/idle.c */ +extern void default_idle_call(void); /* governors */ extern int cpuidle_switch_governor(struct cpuidle_governor *gov); Index: linux-pm/kernel/sched/idle.c =================================================================== --- linux-pm.orig/kernel/sched/idle.c +++ linux-pm/kernel/sched/idle.c @@ -67,11 +67,12 @@ void __weak arch_cpu_idle(void) local_irq_enable(); } -static void default_idle_call(void) { - /* - * We can't use the cpuidle framework, let's use the default idle - * routine. - */ +/** + * default_idle_call - Default CPU idle routine. + * + * To use when the cpuidle framework cannot be used. + */ +void default_idle_call(void) { if (current_clr_polling_and_test()) local_irq_enable(); else @@ -112,9 +113,6 @@ static int call_cpuidle(struct cpuidle_d /* The cpu is no longer idle or about to enter idle. */ idle_set_state(this_rq(), NULL); - if (entered_state == -EBUSY) - default_idle_call(); - return entered_state; }