From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tejun Heo Subject: Re: poll: allow f_op->poll to sleep, take #3 Date: Sun, 23 Nov 2008 18:14:46 +0900 Message-ID: <49291F06.5040907@gmail.com> References: <20081122123942.GF5707@parisc-linux.org> <4927FE87.6050005@gmail.com> <20081122105356.87856d04.akpm@linux-foundation.org> <4928B162.9030404@gmail.com> <20081123085902.GI30453@elte.hu> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Davide Libenzi , 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 To: Ingo Molnar Return-path: Received: from ag-out-0708.google.com ([72.14.246.248]:39063 "EHLO ag-out-0708.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752828AbYKWJOy (ORCPT ); Sun, 23 Nov 2008 04:14:54 -0500 Received: by ag-out-0708.google.com with SMTP id 31so1152615agc.10 for ; Sun, 23 Nov 2008 01:14:52 -0800 (PST) In-Reply-To: <20081123085902.GI30453@elte.hu> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Ingo Molnar wrote: > * 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. Well, the problem is that for wait wake up functions @mode and @sync are passed as parameter and should be passed over to actual wake up function as-is, if I add @mode and @sync to wake_up_process() family of APIs, it's just try_to_wake_up(). Thanks. -- tejun