From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755932AbbBLPy6 (ORCPT ); Thu, 12 Feb 2015 10:54:58 -0500 Received: from v094114.home.net.pl ([79.96.170.134]:57950 "HELO v094114.home.net.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1753412AbbBLPy4 (ORCPT ); Thu, 12 Feb 2015 10:54:56 -0500 From: "Rafael J. Wysocki" To: Peter Zijlstra Cc: Thomas Gleixner , Alan Cox , "Li, Aubrey" , LKML , Linux PM list , ACPI Devel Maling List , Kristen Carlson Accardi , John Stultz , Len Brown Subject: Re: [PATCH 1/6] PM / sleep: Re-implement suspend-to-idle handling Date: Thu, 12 Feb 2015 17:18 +0100 Message-ID: <2207863.Kc1JySZNG4@vostro.rjw.lan> User-Agent: KMail/4.11.5 (Linux/3.16.0-rc5+; KDE/4.11.5; x86_64; ; ) In-Reply-To: <20150212131420.GW23123@twins.programming.kicks-ass.net> References: <8292243.ibkmfVtXac@vostro.rjw.lan> <5802443.EAllF0NTnO@vostro.rjw.lan> <20150212131420.GW23123@twins.programming.kicks-ass.net> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="utf-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thursday, February 12, 2015 02:14:20 PM Peter Zijlstra wrote: > On Wed, Feb 11, 2015 at 05:01:09AM +0100, Rafael J. Wysocki wrote: > > +/* Suspend-to-idle state machnine. */ > > +enum freeze_state { > > + FREEZE_STATE_NONE, /* Not suspended/suspending. */ > > + FREEZE_STATE_ENTER, /* Enter suspend-to-idle. */ > > + FREEZE_STATE_WAKE, /* Wake up from suspend-to-idle. */ > > +}; > > + > > +static enum freeze_state __read_mostly suspend_freeze_state; > > +static DEFINE_SPINLOCK(suspend_freeze_lock); > > + > > +bool idle_should_freeze(void) > > +{ > > + return unlikely(suspend_freeze_state == FREEZE_STATE_ENTER); > > +} > > I don't see how a compiler can propagate the unlikely through an actual > function call. AFAICT that needs to be an inline function for that to > work. Oh. That was silly, I'll send an update later today. > It would mean exposing suspend_freeze_state and the enum; is there a > reason not to want to do that? Not really.