From mboxrd@z Thu Jan 1 00:00:00 1970 From: Peter Zijlstra Subject: Re: [PATCH 1/3] sched: Add new API wake_up_if_idle() to wake up the idle cpu Date: Wed, 3 Sep 2014 11:54:10 +0200 Message-ID: <20140903095410.GJ4783@worktop.ger.corp.intel.com> References: <1408351052-25075-1-git-send-email-chuansheng.liu@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from bombadil.infradead.org ([198.137.202.9]:48224 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753125AbaICJyf (ORCPT ); Wed, 3 Sep 2014 05:54:35 -0400 Content-Disposition: inline In-Reply-To: Sender: linux-pm-owner@vger.kernel.org List-Id: linux-pm@vger.kernel.org To: Andy Lutomirski Cc: Chuansheng Liu , "linux-pm@vger.kernel.org" , "Rafael J. Wysocki" , Daniel Lezcano , "Wang, Xiaoming" , Ingo Molnar , "Chakravarty, Souvik K" , "Liu, Changcheng" , "linux-kernel@vger.kernel.org" On Thu, Aug 21, 2014 at 02:21:51PM -0700, Andy Lutomirski wrote: > On Aug 18, 2014 3:52 AM, "Chuansheng Liu" wrote: > > +void wake_up_if_idle(int cpu) > > +{ > > + struct rq *rq = cpu_rq(cpu); > > + unsigned long flags; > > + > > + if (set_nr_if_polling(rq->idle)) { > > + trace_sched_wake_idle_without_ipi(cpu); > > + } else { > > + > > FWIW, adding: > > if (rq->curr != rq->idle) > return; > > Right here could improve performance on large, mostly non-idle > systems. It would skip the spinlock in most cases. > !is_idle_task() :-)