Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757454AbYKWI7h (ORCPT ); Sun, 23 Nov 2008 03:59:37 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752777AbYKWI72 (ORCPT ); Sun, 23 Nov 2008 03:59:28 -0500 Received: from mx3.mail.elte.hu ([157.181.1.138]:40373 "EHLO mx3.mail.elte.hu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752383AbYKWI71 (ORCPT ); Sun, 23 Nov 2008 03:59:27 -0500 Date: Sun, 23 Nov 2008 09:59:02 +0100 From: Ingo Molnar To: Davide Libenzi Cc: Tejun Heo , Andrew Morton , Matthew Wilcox , Miklos Szeredi , arjan@linux.intel.com, Linus Torvalds , hch@infradead.org, rminnich@sandia.gov, ericvh@gmail.com, Linux Kernel Mailing List , linux-fsdevel@vger.kernel.org Subject: Re: poll: allow f_op->poll to sleep, take #3 Message-ID: <20081123085902.GI30453@elte.hu> References: <20081122123942.GF5707@parisc-linux.org> <4927FE87.6050005@gmail.com> <20081122105356.87856d04.akpm@linux-foundation.org> <4928B162.9030404@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.18 (2008-05-17) X-ELTE-VirusStatus: clean X-ELTE-SpamScore: -1.5 X-ELTE-SpamLevel: X-ELTE-SpamCheck: no X-ELTE-SpamVersion: ELTE 2.0 X-ELTE-SpamCheck-Details: score=-1.5 required=5.9 tests=BAYES_00 autolearn=no SpamAssassin version=3.2.3 -1.5 BAYES_00 BODY: Bayesian spam probability is 0 to 1% [score: 0.0000] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1208 Lines: 34 * Davide Libenzi wrote: > On Sun, 23 Nov 2008, Tejun Heo wrote: > > > +static int pollwake(wait_queue_t *wait, unsigned mode, int sync, void *key) > > +{ > > + struct poll_wqueues *pwq = wait->private; > > + DECLARE_WAITQUEUE(dummy_wait, pwq->polling_task); > > + > > + set_mb(pwq->triggered, 1); > > + > > + /* perform the default wake up operation */ > > + return default_wake_function(&dummy_wait, mode, sync, key); > > +} > > Wouldn't it be nicer to un-static try_to_wake_up() (or a wrapper) > instead of setting up a fake wait queue just to use > default_wake_function(), just to wake up a task? the already existing single-task-wakeup shortcut method made available by the scheduler is wake_up_process(). A number of primitives where waitqueue overhead is of concern already make use of it. (mutexes/rtmutexes and more) if you need a different mode flag, then please extend the wake_up_process() family of APIs. Ingo -- 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/