From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751527Ab0CAQpE (ORCPT ); Mon, 1 Mar 2010 11:45:04 -0500 Received: from darkcity.gna.ch ([195.226.6.51]:39312 "EHLO mail.gna.ch" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751363Ab0CAQpA convert rfc822-to-8bit (ORCPT ); Mon, 1 Mar 2010 11:45:00 -0500 X-Greylist: delayed 455 seconds by postgrey-1.27 at vger.kernel.org; Mon, 01 Mar 2010 11:45:00 EST Subject: Re: [PATCH][RFC] time: add wait_interruptible_timeout macro to sleep (w. timeout) until wake_up From: Michel =?ISO-8859-1?Q?D=E4nzer?= To: =?UTF-8?Q?Rafa=C5=82_Mi=C5=82ecki?= Cc: Andrew Morton , Thomas Gleixner , DRI , Linus Torvalds , Ingo Molnar , Linux Kernel Mailing List In-Reply-To: References: <1266761422-2921-1-git-send-email-zajec5@gmail.com> <20100226081418.5902446f.akpm@linux-foundation.org> <20100226190100.GQ10145@sci.fi> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT Date: Mon, 01 Mar 2010 17:37:18 +0100 Message-ID: <1267461438.5157.9586.camel@thor.local> Mime-Version: 1.0 X-Mailer: Evolution 2.28.2 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 2010-02-27 at 10:33 +0100, Rafał Miłecki wrote: > W dniu 26 lutego 2010 20:01 użytkownik Ville Syrjälä napisał: > > Disabling the condition check doesn't make sense. > > > > You could use a completion. > > > > init_completion(vbl_irq); > > enable_vbl_irq(); > > wait_for_completion(vbl_irq); > > disable_vbl_irq(); > > and call complete(vbl_irq) in the interrupt handler. > > > > The same would of course work with just some flag or counter > > and a wait queue. > > Ouch, I can see it gone bad already. > > Firstly I simply just wanted to avoid condition in wait_event_*. It > looked unnecessary as I got interrupts (signals). So this code runs in user process context? If so, it should return to userspace ASAP on signal receipt, otherwise e.g. smoothness of X mouse movement may suffer. If that's a problem, then maybe the code should run in a different context, e.g. a tasklet or some kind of worker kernel thread. -- Earthling Michel Dänzer | http://www.vmware.com Libre software enthusiast | Debian, X and DRI developer