From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753422AbcBVPDU (ORCPT ); Mon, 22 Feb 2016 10:03:20 -0500 Received: from e23smtp05.au.ibm.com ([202.81.31.147]:32919 "EHLO e23smtp05.au.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750746AbcBVPDR (ORCPT ); Mon, 22 Feb 2016 10:03:17 -0500 X-IBM-Helo: d23dlp03.au.ibm.com X-IBM-MailFrom: shreyas@linux.vnet.ibm.com X-IBM-RcptTo: linux-kernel@vger.kernel.org;linux-pm@vger.kernel.org Message-ID: <56CB22F5.8010808@linux.vnet.ibm.com> Date: Mon, 22 Feb 2016 20:32:13 +0530 From: Shreyas B Prabhu User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.1.0 MIME-Version: 1.0 To: Daniel Lezcano CC: tglx@linutronix.de, peterz@infradead.org, rafael@kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, nicolas.pitre@linaro.org, vincent.guittot@linaro.org Subject: Re: [PATCH V3 2/2] sched: idle: IRQ based next prediction for idle period References: <1455637383-14412-1-git-send-email-daniel.lezcano@linaro.org> <1455637383-14412-2-git-send-email-daniel.lezcano@linaro.org> In-Reply-To: <1455637383-14412-2-git-send-email-daniel.lezcano@linaro.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16022215-0017-0000-0000-000002DB6379 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Daniel, On 02/16/2016 09:13 PM, Daniel Lezcano wrote: > + > +/** > + * sched_idle_next_wakeup - Predict the next wakeup on the current cpu > + * > + * The next event on the cpu is based on a statistic approach of the > + * interrupt events and the timer deterministic value. From the timer > + * or the irqs, we return the one expected to occur first. > + * > + * Returns the expected remaining idle time before being woken up by > + * an interruption. > + */ > +s64 sched_idle_next_wakeup(void) > +{ > + s64 next_timer = ktime_to_us(tick_nohz_get_sleep_length()); > + s64 next_irq = next_irq_event(); Since next_irq_event() uses RCU and we are in idle this should probably be wrapped in RCU_NONIDLE(). > + > + return min(next_irq, next_timer); > +} > + Thanks, Shreyas