Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756369Ab2EPP7i (ORCPT ); Wed, 16 May 2012 11:59:38 -0400 Received: from iolanthe.rowland.org ([192.131.102.54]:54035 "HELO iolanthe.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1756068Ab2EPP7f (ORCPT ); Wed, 16 May 2012 11:59:35 -0400 Date: Wed, 16 May 2012 11:59:34 -0400 (EDT) From: Alan Stern X-X-Sender: stern@iolanthe.rowland.org To: Lin Ming cc: Jens Axboe , Jeff Moyer , , , Subject: Re: [RFC PATCH 3/3] block: add queue idle timer In-Reply-To: <1337182820.4047.18.camel@hp6530s> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1265 Lines: 35 On Wed, 16 May 2012, Lin Ming wrote: > > Lin, you should have more slack timer handling. Look at the blk-timeout > > handling of request timeouts for inspiration, and/or the thread that > > Jeff also references. Doing a timer add/del for each request put is a no > > go. > > You mentioned how to detect queue idle in the referenced thread: > > === > So we could probably add an idle timer that is set to some suitable > timeout for this and would be added when the queue first goes empty. If > new requests come in, just let it simmer and defer checking the state to > when it actually fires. That is basically how the runtime PM timer works, if you use it as I described earlier. > === > > What do you mean of "the queue first goes empty"? When the queue is first created, the timer is started. Whenever the timer expires, the code checks to see if any requests have been processed since the previous expiration. If they have, the timer is restarted. If they haven't, you suspend the device. Alan Stern -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/