From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756100Ab0EZWDP (ORCPT ); Wed, 26 May 2010 18:03:15 -0400 Received: from ogre.sisk.pl ([217.79.144.158]:44714 "EHLO ogre.sisk.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752831Ab0EZWDN (ORCPT ); Wed, 26 May 2010 18:03:13 -0400 From: "Rafael J. Wysocki" To: Matthew Garrett Subject: Re: [PATCH 1/8] PM: Opportunistic suspend support. Date: Thu, 27 May 2010 00:03:58 +0200 User-Agent: KMail/1.12.4 (Linux/2.6.34-tst; KDE/4.3.5; x86_64; ; ) Cc: Peter Zijlstra , Arve =?iso-8859-1?q?Hj=F8nnev=E5g?= , Alan Stern , Dmitry Torokhov , "Linux-pm mailing list" , Kernel development list , Len Brown , Pavel Machek , Randy Dunlap , Andrew Morton , Andi Kleen , Cornelia Huck , Tejun Heo , Jesse Barnes , Nigel Cunningham , Ming Lei , Wu Fengguang , Maxim Levitsky , linux-doc@vger.kernel.org, Greg KH , tytso@mit.edu, James Bottomley References: <1274878665.27810.354.camel@twins> <20100526132051.GA1834@srcf.ucam.org> In-Reply-To: <20100526132051.GA1834@srcf.ucam.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201005270003.58277.rjw@sisk.pl> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wednesday 26 May 2010, Matthew Garrett wrote: > On Wed, May 26, 2010 at 02:57:45PM +0200, Peter Zijlstra wrote: > > > I fail to see why. In both cases the woken userspace will contact a > > central governing task, either the kernel or the userspace suspend > > manager, and inform it there is work to be done, and please don't > > suspend now. > > Thinking about this, you're right - we don't have to wait, but that does > result in another problem. Imagine we get two wakeup events > approximately simultaneously. In the kernel-level universe the kernel > knows when both have been handled. In the user-level universe, we may > have one task schedule, bump the count, handle the event, drop the count > and then we attempt a suspend again because the second event handler > hasn't had an opportunity to run yet. We'll then attempt a suspend and > immediately bounce back up. That's kind of wasteful, although it'd be > somewhat mitigated by checking that right at the top of suspend entry > and returning -EAGAIN or similar. I still think it would cause a loop-alike behavior between the user space power manager and the kernel PM core to happen, because the power manager will always have to check the user space counter after a failing suspend attempt. Rafael