Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759734Ab3DBBoN (ORCPT ); Mon, 1 Apr 2013 21:44:13 -0400 Received: from li9-11.members.linode.com ([67.18.176.11]:57992 "EHLO imap.thunk.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758472Ab3DBBoM (ORCPT ); Mon, 1 Apr 2013 21:44:12 -0400 Date: Mon, 1 Apr 2013 21:43:53 -0400 From: "Theodore Ts'o" To: Kent Overstreet Cc: linux-kernel@vger.kernel.org, linux-aio@kvack.org, akpm@linux-foundation.org, Thomas Gleixner , Ingo Molnar , Zach Brown , Felipe Balbi , Greg Kroah-Hartman , Mark Fasheh , Joel Becker , Rusty Russell , Jens Axboe , Asai Thambi S P , Selvan Mani , Sam Bradshaw , Jeff Moyer , Al Viro , Benjamin LaHaise Subject: Re: [PATCH 13/33] wait: add wait_event_hrtimeout() Message-ID: <20130402014353.GB30122@thunk.org> Mail-Followup-To: Theodore Ts'o , Kent Overstreet , linux-kernel@vger.kernel.org, linux-aio@kvack.org, akpm@linux-foundation.org, Thomas Gleixner , Ingo Molnar , Zach Brown , Felipe Balbi , Greg Kroah-Hartman , Mark Fasheh , Joel Becker , Rusty Russell , Jens Axboe , Asai Thambi S P , Selvan Mani , Sam Bradshaw , Jeff Moyer , Al Viro , Benjamin LaHaise References: <1363883754-27966-1-git-send-email-koverstreet@google.com> <1363883754-27966-14-git-send-email-koverstreet@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1363883754-27966-14-git-send-email-koverstreet@google.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: tytso@thunk.org X-SA-Exim-Scanned: No (on imap.thunk.org); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1514 Lines: 30 On Thu, Mar 21, 2013 at 09:35:34AM -0700, Kent Overstreet wrote: > Analagous to wait_event_timeout() and friends, this adds > wait_event_hrtimeout() and wait_event_interruptible_hrtimeout(). > > Note that unlike the versions that use regular timers, these don't return > the amount of time remaining when they return - instead, they return 0 or > -ETIME if they timed out. because I was uncomfortable with the semantics > of doing it the other way (that I could get it right, anyways). > > If the timer expires, there's no real guarantee that expire_time - > current_time would be <= 0 - due to timer slack certainly, and I'm not > sure I want to know the implications of the different clock bases in > hrtimers. > > If the timer does expire and the code calculates that the time remaining > is nonnegative, that could be even worse if the calling code then reuses > that timeout. Probably safer to just return 0 then, but I could imagine > weird bugs or at least unintended behaviour arising from that too. > > I came to the conclusion that if other users end up actually needing the > amount of time remaining, the sanest thing to do would be to create a > version that uses absolute timeouts instead of relative. Reviewed-by: "Theodore Ts'o" -- 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/