From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1761066AbZB0Wzu (ORCPT ); Fri, 27 Feb 2009 17:55:50 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1757527AbZB0Wzm (ORCPT ); Fri, 27 Feb 2009 17:55:42 -0500 Received: from ogre.sisk.pl ([217.79.144.158]:46118 "EHLO ogre.sisk.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753871AbZB0Wzm convert rfc822-to-8bit (ORCPT ); Fri, 27 Feb 2009 17:55:42 -0500 From: "Rafael J. Wysocki" To: Arve =?iso-8859-1?q?Hj=F8nnev=E5g?= Subject: Re: [RFD] Automatic suspend Date: Fri, 27 Feb 2009 23:55:10 +0100 User-Agent: KMail/1.11.0 (Linux/2.6.29-rc5-tst; KDE/4.2.0; x86_64; ; ) Cc: Matthew Garrett , Pavel Machek , Alan Stern , "Woodruff, Richard" , Arjan van de Ven , Kyle Moffett , Oliver Neukum , Benjamin Herrenschmidt , pm list , LKML , Nigel Cunningham , mark gross , Uli Luckas , Igor Stoppa , Brian Swetland , Len Brown References: <200902192215.18365.rjw@sisk.pl> <200902272154.03539.rjw@sisk.pl> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8BIT Content-Disposition: inline Message-Id: <200902272355.12240.rjw@sisk.pl> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Friday 27 February 2009, Arve Hjønnevåg wrote: > On Fri, Feb 27, 2009 at 12:54 PM, Rafael J. Wysocki wrote: > > On Friday 27 February 2009, Matthew Garrett wrote: > >> On Fri, Feb 27, 2009 at 03:22:39PM +0100, Rafael J. Wysocki wrote: > >> > On Friday 27 February 2009, Pavel Machek wrote: > >> > > Wakelocks done right are single atomic_t... and if you set it to 0, > >> > > you just unblock "sleeper" thread or something. Zero polling and very > >> > > simple... > >> > > >> > Except that you have to check all of the wakelocks periodically in a loop => > >> > polling. So? > >> > >> Why do you need to check them? If you're taking this approach you just > >> have something like: > >> > >> suspend_unblock() { > >> if (atomc_dec_and_test(&suspend_lock)) > >> suspend(); > >> } > >> > >> and then check that the lock count is still 0 after device_suspend(). > >> There's no need to poll. > > > > I was talking about wakelocks as originally proposed. > > Can you be more specific? My wakelock implementation triggers suspend > when the active list becomes empty. No polling required. Sorry, I overlooked and/or didn't remember that. My bad. Rafael