From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754849AbcKNQXa (ORCPT ); Mon, 14 Nov 2016 11:23:30 -0500 Received: from merlin.infradead.org ([205.233.59.134]:34272 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752149AbcKNQX3 (ORCPT ); Mon, 14 Nov 2016 11:23:29 -0500 Date: Mon, 14 Nov 2016 17:22:11 +0100 From: Peter Zijlstra To: Jacob Pan Cc: LKML , Linux PM , Thomas Gleixner , Ingo Molnar , Zhang Rui , Rafael Wysocki , "Chen, Yu C" , Sebastian Andrzej Siewior , Petr Mladek , Srinivas Pandruvada , Arjan van de Ven Subject: Re: [PATCH 1/3] idle: add support for tasks that inject idle Message-ID: <20161114162211.GI3142@twins.programming.kicks-ass.net> References: <1478718312-12847-1-git-send-email-jacob.jun.pan@linux.intel.com> <1478718312-12847-2-git-send-email-jacob.jun.pan@linux.intel.com> <20161114150119.GG3142@twins.programming.kicks-ass.net> <20161114082028.6c0ce338@jacob-builder> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20161114082028.6c0ce338@jacob-builder> User-Agent: Mutt/1.5.23.1 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 14, 2016 at 08:20:28AM -0800, Jacob Pan wrote: > On Mon, 14 Nov 2016 16:01:19 +0100 > Peter Zijlstra wrote: > > > On Wed, Nov 09, 2016 at 11:05:10AM -0800, Jacob Pan wrote: > > > +void play_idle() > > > +{ > > > + /* > > > + * Only FIFO tasks can disable the tick since they don't > > > need the forced > > > + * preemption. > > > + */ > > > + WARN_ON_ONCE(current->policy != SCHED_FIFO); > > > + WARN_ON_ONCE(current->nr_cpus_allowed != 1); > > > + WARN_ON_ONCE(!(current->flags & PF_KTHREAD)); > > > + WARN_ON_ONCE(!(current->flags & PF_NO_SETAFFINITY)); > > > + rcu_sleep_check(); > > > + > > > + preempt_disable(); > > > + current->flags |= PF_IDLE; > > > + do_idle(); > > > + current->flags &= ~PF_IDLE; > > > + > > > + preempt_fold_need_resched(); > > > + preempt_enable(); > > > +} > > > +EXPORT_SYMBOL_GPL(play_idle); > > > > Hurm.. didn't this initially also include the setup of the timer and > > take an timeout argument? > > right, the initial version has a timeout and > init_timer_on_stack(timer); > > I thought since this play_idle timer is likely to expire instead of > being canceled, so I switched to hrtimer by caller. We don't have an on > stack hrtimer, right? or Should we consider adding one? hrtimer_init_on_stack() exists.