From patchwork Mon Feb 24 13:55:50 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 25191 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f72.google.com (mail-oa0-f72.google.com [209.85.219.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7783F2066C for ; Mon, 24 Feb 2014 13:56:30 +0000 (UTC) Received: by mail-oa0-f72.google.com with SMTP id i4sf30431766oah.3 for ; Mon, 24 Feb 2014 05:56:29 -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:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=nDmmAP55EA7NaM/YNqx3Jh4Pax5quMA2U8xj+h7fsDM=; b=iUArEb0D04JwuR08JDOxeV5tvv+ebhk3W46SQ2T6/a4P5C/soK6sfIyDovyOi4f0q0 KPq/umCLK9A18XdzpzBOn6Osd9LsT3/N7cVmnd//N7RLv0m5lMIpnOjoG4o4jEoNavnN sxe5MD1BtkAOrtsPhC/aS9lqE5GnUBNcoJGWuxXXfnWZehCvfm4jOMYBrNtCrHyv12YM 7SzwKU0CaEw2K92LdEE8xA8g/uSoMDTfk3KMv34Nk/L08RqrMyap1jPy0gP74EmeElYR derWxk4ax2b2IrSkUdhgoO7FbZcIjQDWiTb1AS33pLtF1pb7PXqtRdymjTF0uzOerRou 40mg== X-Gm-Message-State: ALoCoQkM6+FW9Hl6XykHxEPuVAMVu6epLZbz53fPuSj9oqIAxct/Q5jLOFibKTBVu7pVXI3Z7p+K X-Received: by 10.50.114.105 with SMTP id jf9mr9409095igb.1.1393250189766; Mon, 24 Feb 2014 05:56:29 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.28.162 with SMTP id 31ls2008233qgz.50.gmail; Mon, 24 Feb 2014 05:56:29 -0800 (PST) X-Received: by 10.52.94.77 with SMTP id da13mr456317vdb.55.1393250189612; Mon, 24 Feb 2014 05:56:29 -0800 (PST) Received: from mail-vc0-f176.google.com (mail-vc0-f176.google.com [209.85.220.176]) by mx.google.com with ESMTPS id be7si5840001vcb.110.2014.02.24.05.56.29 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 24 Feb 2014 05:56:29 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.176 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.176; Received: by mail-vc0-f176.google.com with SMTP id la4so5758463vcb.35 for ; Mon, 24 Feb 2014 05:56:29 -0800 (PST) X-Received: by 10.220.191.134 with SMTP id dm6mr12823063vcb.16.1393250189523; Mon, 24 Feb 2014 05:56:29 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.174.196 with SMTP id u4csp62790vcz; Mon, 24 Feb 2014 05:56:29 -0800 (PST) X-Received: by 10.66.164.229 with SMTP id yt5mr25547285pab.67.1393250188179; Mon, 24 Feb 2014 05:56:28 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k7si49016pbl.221.2014.02.24.05.56.27; Mon, 24 Feb 2014 05:56:27 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752976AbaBXNz6 (ORCPT + 26 others); Mon, 24 Feb 2014 08:55:58 -0500 Received: from mail-we0-f180.google.com ([74.125.82.180]:42991 "EHLO mail-we0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752944AbaBXNz4 (ORCPT ); Mon, 24 Feb 2014 08:55:56 -0500 Received: by mail-we0-f180.google.com with SMTP id u57so4742104wes.11 for ; Mon, 24 Feb 2014 05:55:55 -0800 (PST) X-Received: by 10.194.203.200 with SMTP id ks8mr18948485wjc.61.1393250155062; Mon, 24 Feb 2014 05:55:55 -0800 (PST) Received: from localhost.localdomain (AToulouse-654-1-343-25.w90-55.abo.wanadoo.fr. [90.55.62.25]) by mx.google.com with ESMTPSA id f7sm42338516wjb.7.2014.02.24.05.55.53 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 24 Feb 2014 05:55:54 -0800 (PST) From: Daniel Lezcano To: mingo@kernel.org, peterz@infradead.org, tglx@linutronix.de, rjw@rjwysocki.net Cc: nicolas.pitre@linaro.org, preeti@linux.vnet.ibm.com, linux-kernel@vger.kernel.org Subject: [PATCH V2 4/5] idle: Move idle conditions in cpuidle_idle main function Date: Mon, 24 Feb 2014 14:55:50 +0100 Message-Id: <1393250151-6982-4-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1393250151-6982-1-git-send-email-daniel.lezcano@linaro.org> References: <1393250151-6982-1-git-send-email-daniel.lezcano@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: daniel.lezcano@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.176 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , This patch moves the condition before entering idle into the cpuidle main function located in idle.c. That simplify the idle mainloop functions and increase the readibility of the conditions to enter truly idle. This patch is code reorganization and does not change the behavior of the function. Signed-off-by: Daniel Lezcano --- kernel/sched/idle.c | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ Index: cpuidle-next/kernel/sched/idle.c =================================================================== --- cpuidle-next.orig/kernel/sched/idle.c +++ cpuidle-next/kernel/sched/idle.c @@ -75,6 +75,23 @@ static int cpuidle_idle_call(void) struct cpuidle_driver *drv = cpuidle_get_cpu_driver(dev); int next_state, entered_state; + /* + * In poll mode we reenable interrupts and spin. + * + * Also if we detected in the wakeup from idle path that the + * tick broadcast device expired for us, we don't want to go + * deep idle as we know that the IPI is going to arrive right + * away + */ + if (cpu_idle_force_poll || tick_check_broadcast_expired()) + return cpu_idle_poll(); + + if (current_clr_polling_and_test()) { + local_irq_enable(); + __current_set_polling(); + return 0; + } + stop_critical_timings(); rcu_idle_enter(); @@ -115,6 +132,8 @@ out: rcu_idle_exit(); start_critical_timings(); + __current_set_polling(); + return 0; } @@ -136,25 +155,8 @@ static void cpu_idle_loop(void) local_irq_disable(); arch_cpu_idle_enter(); - /* - * In poll mode we reenable interrupts and spin. - * - * Also if we detected in the wakeup from idle - * path that the tick broadcast device expired - * for us, we don't want to go deep idle as we - * know that the IPI is going to arrive right - * away - */ - if (cpu_idle_force_poll || tick_check_broadcast_expired()) { - cpu_idle_poll(); - } else { - if (!current_clr_polling_and_test()) { - cpuidle_idle_call(); - } else { - local_irq_enable(); - } - __current_set_polling(); - } + cpuidle_idle_call(); + arch_cpu_idle_exit(); /* * We need to test and propagate the TIF_NEED_RESCHED