Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751977Ab3FYO6J (ORCPT ); Tue, 25 Jun 2013 10:58:09 -0400 Received: from merlin.infradead.org ([205.233.59.134]:50930 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751135Ab3FYO6F (ORCPT ); Tue, 25 Jun 2013 10:58:05 -0400 Date: Tue, 25 Jun 2013 16:57:54 +0200 From: Jens Axboe To: Steven Rostedt Cc: Linus Torvalds , Ingo Molnar , Matthew Wilcox , Al Viro , Ingo Molnar , Linux Kernel Mailing List , linux-nvme@lists.infradead.org, Linux SCSI List , Andrew Morton , Peter Zijlstra , Thomas Gleixner Subject: Re: RFC: Allow block drivers to poll for I/O instead of sleeping Message-ID: <20130625145754.GL5594@kernel.dk> References: <20130620201713.GV8211@linux.intel.com> <20130623100920.GA19021@gmail.com> <20130624071718.GS9422@kernel.dk> <20130625001102.GA6623@home.goodmis.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20130625001102.GA6623@home.goodmis.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1399 Lines: 37 On Mon, Jun 24 2013, Steven Rostedt wrote: > On Mon, Jun 24, 2013 at 09:17:18AM +0200, Jens Axboe wrote: > > On Sun, Jun 23 2013, Linus Torvalds wrote: > > > > > > You could try to do that either *in* the idle thread (which would take > > > the context switch overhead - maybe negating some of the advantages), > > > or alternatively hook into the scheduler idle logic before actually > > > doing the switch. > > > > It can't happen in the idle thread. If you need to take the context > > switch, then you've negated pretty much all of the gain of the polled > > approach. > > What about hooking into the idle_balance code? That happens if we are > about to go to idle but before the full schedule switch to the idle > task. > > > In __schedule(void): > > if (unlikely(!rq->nr_running)) > idle_balance(cpu, rq); If you can avoid the switch (sleep/wakeup), then that's what matters. If you end up sleeping, you've lost that latency game and polling is mostly useful in the blk_iopoll designed fashion for high iops scenarios. Besides, you need the task + page context to be able to find out what to poll for (and when to stop). -- Jens Axboe -- 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/