Re: [patch] change futex_wait() to hrtimers

2007-03-14 Thread linux
> BTW. my futex man page says timeout's contents "describe the maximum duration > of the wait". Surely that should be *minimum*? Michael cc'ed. Er, the intent of the wording is to say "futex will wait until uaddr no longer contains val, or the timeout expires, whichever happens first". One

Re: [patch] change futex_wait() to hrtimers

2007-03-14 Thread linux
BTW. my futex man page says timeout's contents describe the maximum duration of the wait. Surely that should be *minimum*? Michael cc'ed. Er, the intent of the wording is to say futex will wait until uaddr no longer contains val, or the timeout expires, whichever happens first. One option for

Re: [patch] change futex_wait() to hrtimers

2007-03-12 Thread Ingo Molnar
* Theodore Tso <[EMAIL PROTECTED]> wrote: > What we probably need in the long-term, and not just for high > precision wakeups, is we need a way for waiters (either in the kernel > or in userspace) to specify a desired precision in their timers. Is > it, "wake me up in a second, exactly", or

Re: [patch] change futex_wait() to hrtimers

2007-03-12 Thread Nick Piggin
On Mon, Mar 12, 2007 at 10:12:14AM -0400, Theodore Tso wrote: > On Mon, Mar 12, 2007 at 11:58:26AM +0100, Andi Kleen wrote: > > On Mon, Mar 12, 2007 at 12:00:20PM +0100, Thomas Gleixner wrote: > > > On Mon, 2007-03-12 at 12:27 +0100, Andi Kleen wrote: > > > > Ingo Molnar <[EMAIL PROTECTED]>

Re: [patch] change futex_wait() to hrtimers

2007-03-12 Thread Andi Kleen
> This becomes especially important if we want the tickless code to > really shine as far as power management is concerned. Unfortunately, > the POSIX timer abstraction doesn't give this kind of flexibility > easily, so it's going to be a while before we see significant > userspace adoption of

Re: [patch] change futex_wait() to hrtimers

2007-03-12 Thread Theodore Tso
On Mon, Mar 12, 2007 at 11:58:26AM +0100, Andi Kleen wrote: > On Mon, Mar 12, 2007 at 12:00:20PM +0100, Thomas Gleixner wrote: > > On Mon, 2007-03-12 at 12:27 +0100, Andi Kleen wrote: > > > Ingo Molnar <[EMAIL PROTECTED]> writes: > > > > > > > > the only correct approach is the use of hrtimers,

Re: [patch] change futex_wait() to hrtimers

2007-03-12 Thread Nick Piggin
On Mon, Mar 12, 2007 at 01:21:03PM +0100, Ingo Molnar wrote: > > * Nick Piggin <[EMAIL PROTECTED]> wrote: > > > > > > the issue is this: your fix reduces the effects of the bug but > > > > > it is still fundamentally incomplete because of the use of > > > > > timer_list. So > > > > > > > >

Re: [patch] change futex_wait() to hrtimers

2007-03-12 Thread Ingo Molnar
* Nick Piggin <[EMAIL PROTECTED]> wrote: > > > > the issue is this: your fix reduces the effects of the bug but > > > > it is still fundamentally incomplete because of the use of > > > > timer_list. So > > > > > > But using schedule_timeout is not a bug. Userspace timeouts are > > > always

Re: [patch] change futex_wait() to hrtimers

2007-03-12 Thread Nick Piggin
On Mon, Mar 12, 2007 at 12:38:29PM +0100, Ingo Molnar wrote: > > * Nick Piggin <[EMAIL PROTECTED]> wrote: > > > > the issue is this: your fix reduces the effects of the bug but it is > > > still fundamentally incomplete because of the use of timer_list. So > > > > But using schedule_timeout is

Re: [patch] change futex_wait() to hrtimers

2007-03-12 Thread Ingo Molnar
* Nick Piggin <[EMAIL PROTECTED]> wrote: > > the issue is this: your fix reduces the effects of the bug but it is > > still fundamentally incomplete because of the use of timer_list. So > > But using schedule_timeout is not a bug. Userspace timeouts are always > defined to be "at least". but

Re: [patch] change futex_wait() to hrtimers

2007-03-12 Thread Ingo Molnar
* Andi Kleen <[EMAIL PROTECTED]> wrote: > > if HIGH_RES_TIMERS is disabled then that is what happens. But > > frankly, > > disabled? I would expect it (= more wakeups) when hrtimers are > enabled. i mean the groupping of timer expiries happens automatically when high-res is disabled. When

Re: [patch] change futex_wait() to hrtimers

2007-03-12 Thread Nick Piggin
On Mon, Mar 12, 2007 at 12:19:58PM +0100, Ingo Molnar wrote: > > * Nick Piggin <[EMAIL PROTECTED]> wrote: > > > > even if this means more work for you (i'm sorry about that!) i'm > > > quite sure we should take Sebastien's hrtimers based implementation > > > of futex_wait(), and use the

Re: [patch] change futex_wait() to hrtimers

2007-03-12 Thread Andi Kleen
> if HIGH_RES_TIMERS is disabled then that is what happens. But frankly, disabled? I would expect it (= more wakeups) when hrtimers are enabled. > most futex waits are without timeouts - if an application cares about > micro-effects like that then you are much better off not using a >

Re: [patch] change futex_wait() to hrtimers

2007-03-12 Thread Ingo Molnar
* Nick Piggin <[EMAIL PROTECTED]> wrote: > > even if this means more work for you (i'm sorry about that!) i'm > > quite sure we should take Sebastien's hrtimers based implementation > > of futex_wait(), and use the nanosleep method to restart it. There's > > no point in further tweaking the

Re: [patch] change futex_wait() to hrtimers

2007-03-12 Thread Thomas Gleixner
On Mon, 2007-03-12 at 12:02 +0100, Ingo Molnar wrote: > > Well I did convert futex_wait to an absolute timeout based version in > > the subsequent incremental patch. I think that is OK? > > it still has the rounding artifacts: using timer_list there is no way to > do a precise long sleep based

Re: [patch] change futex_wait() to hrtimers

2007-03-12 Thread Nick Piggin
On Mon, Mar 12, 2007 at 12:02:04PM +0100, Ingo Molnar wrote: > > * Nick Piggin <[EMAIL PROTECTED]> wrote: > > > > i dont think we should try to do this. We should not and cannot do > > > anything about all of the artifacts that comes with the use of > > > relative timeouts and

Re: [patch] change futex_wait() to hrtimers

2007-03-12 Thread Ingo Molnar
* Andi Kleen <[EMAIL PROTECTED]> wrote: > On Mon, Mar 12, 2007 at 12:00:20PM +0100, Thomas Gleixner wrote: > > On Mon, 2007-03-12 at 12:27 +0100, Andi Kleen wrote: > > > Ingo Molnar <[EMAIL PROTECTED]> writes: > > > > > > > > the only correct approach is the use of hrtimers, and a patch exists

Re: [patch] change futex_wait() to hrtimers

2007-03-12 Thread Ingo Molnar
* Nick Piggin <[EMAIL PROTECTED]> wrote: > > i dont think we should try to do this. We should not and cannot do > > anything about all of the artifacts that comes with the use of > > relative timeouts and schedule_timeout(). > > > > basically, using jiffies here (which schedule_timeout()

Re: [patch] change futex_wait() to hrtimers

2007-03-12 Thread Andi Kleen
On Mon, Mar 12, 2007 at 12:00:20PM +0100, Thomas Gleixner wrote: > On Mon, 2007-03-12 at 12:27 +0100, Andi Kleen wrote: > > Ingo Molnar <[EMAIL PROTECTED]> writes: > > > > > > the only correct approach is the use of hrtimers, and a patch exists for > > > that - see below. This has been included

Re: [patch] change futex_wait() to hrtimers

2007-03-12 Thread Thomas Gleixner
On Mon, 2007-03-12 at 12:27 +0100, Andi Kleen wrote: > Ingo Molnar <[EMAIL PROTECTED]> writes: > > > > the only correct approach is the use of hrtimers, and a patch exists for > > that - see below. This has been included in -rt for quite some time. > > But isn't that bad for power management?

Re: [patch] change futex_wait() to hrtimers

2007-03-12 Thread Andi Kleen
Ingo Molnar <[EMAIL PROTECTED]> writes: > > the only correct approach is the use of hrtimers, and a patch exists for > that - see below. This has been included in -rt for quite some time. But isn't that bad for power management? You'll likely get more idle wakeups, won't you? -Andi - To

Re: [patch] change futex_wait() to hrtimers

2007-03-12 Thread Nick Piggin
On Mon, Mar 12, 2007 at 10:10:06AM +0100, Ingo Molnar wrote: > > * Roland McGrath <[EMAIL PROTECTED]> wrote: > > > I agree it should restart. But I don't think this is quite right in > > the timeout case. It will increase the total maximum real time spent > > arbitrarily by the amount of

Re: [patch] change futex_wait() to hrtimers

2007-03-12 Thread Nick Piggin
On Mon, Mar 12, 2007 at 10:10:06AM +0100, Ingo Molnar wrote: * Roland McGrath [EMAIL PROTECTED] wrote: I agree it should restart. But I don't think this is quite right in the timeout case. It will increase the total maximum real time spent arbitrarily by the amount of time elapsed

Re: [patch] change futex_wait() to hrtimers

2007-03-12 Thread Andi Kleen
Ingo Molnar [EMAIL PROTECTED] writes: the only correct approach is the use of hrtimers, and a patch exists for that - see below. This has been included in -rt for quite some time. But isn't that bad for power management? You'll likely get more idle wakeups, won't you? -Andi - To

Re: [patch] change futex_wait() to hrtimers

2007-03-12 Thread Thomas Gleixner
On Mon, 2007-03-12 at 12:27 +0100, Andi Kleen wrote: Ingo Molnar [EMAIL PROTECTED] writes: the only correct approach is the use of hrtimers, and a patch exists for that - see below. This has been included in -rt for quite some time. But isn't that bad for power management? You'll

Re: [patch] change futex_wait() to hrtimers

2007-03-12 Thread Andi Kleen
On Mon, Mar 12, 2007 at 12:00:20PM +0100, Thomas Gleixner wrote: On Mon, 2007-03-12 at 12:27 +0100, Andi Kleen wrote: Ingo Molnar [EMAIL PROTECTED] writes: the only correct approach is the use of hrtimers, and a patch exists for that - see below. This has been included in -rt for

Re: [patch] change futex_wait() to hrtimers

2007-03-12 Thread Ingo Molnar
* Nick Piggin [EMAIL PROTECTED] wrote: i dont think we should try to do this. We should not and cannot do anything about all of the artifacts that comes with the use of relative timeouts and schedule_timeout(). basically, using jiffies here (which schedule_timeout() does) is

Re: [patch] change futex_wait() to hrtimers

2007-03-12 Thread Ingo Molnar
* Andi Kleen [EMAIL PROTECTED] wrote: On Mon, Mar 12, 2007 at 12:00:20PM +0100, Thomas Gleixner wrote: On Mon, 2007-03-12 at 12:27 +0100, Andi Kleen wrote: Ingo Molnar [EMAIL PROTECTED] writes: the only correct approach is the use of hrtimers, and a patch exists for that

Re: [patch] change futex_wait() to hrtimers

2007-03-12 Thread Thomas Gleixner
On Mon, 2007-03-12 at 12:02 +0100, Ingo Molnar wrote: Well I did convert futex_wait to an absolute timeout based version in the subsequent incremental patch. I think that is OK? it still has the rounding artifacts: using timer_list there is no way to do a precise long sleep based on many

Re: [patch] change futex_wait() to hrtimers

2007-03-12 Thread Nick Piggin
On Mon, Mar 12, 2007 at 12:02:04PM +0100, Ingo Molnar wrote: * Nick Piggin [EMAIL PROTECTED] wrote: i dont think we should try to do this. We should not and cannot do anything about all of the artifacts that comes with the use of relative timeouts and schedule_timeout().

Re: [patch] change futex_wait() to hrtimers

2007-03-12 Thread Ingo Molnar
* Nick Piggin [EMAIL PROTECTED] wrote: even if this means more work for you (i'm sorry about that!) i'm quite sure we should take Sebastien's hrtimers based implementation of futex_wait(), and use the nanosleep method to restart it. There's no point in further tweaking the imprecise

Re: [patch] change futex_wait() to hrtimers

2007-03-12 Thread Andi Kleen
if HIGH_RES_TIMERS is disabled then that is what happens. But frankly, disabled? I would expect it (= more wakeups) when hrtimers are enabled. most futex waits are without timeouts - if an application cares about micro-effects like that then you are much better off not using a per-futex

Re: [patch] change futex_wait() to hrtimers

2007-03-12 Thread Ingo Molnar
* Andi Kleen [EMAIL PROTECTED] wrote: if HIGH_RES_TIMERS is disabled then that is what happens. But frankly, disabled? I would expect it (= more wakeups) when hrtimers are enabled. i mean the groupping of timer expiries happens automatically when high-res is disabled. When high-res

Re: [patch] change futex_wait() to hrtimers

2007-03-12 Thread Nick Piggin
On Mon, Mar 12, 2007 at 12:19:58PM +0100, Ingo Molnar wrote: * Nick Piggin [EMAIL PROTECTED] wrote: even if this means more work for you (i'm sorry about that!) i'm quite sure we should take Sebastien's hrtimers based implementation of futex_wait(), and use the nanosleep method to

Re: [patch] change futex_wait() to hrtimers

2007-03-12 Thread Ingo Molnar
* Nick Piggin [EMAIL PROTECTED] wrote: the issue is this: your fix reduces the effects of the bug but it is still fundamentally incomplete because of the use of timer_list. So But using schedule_timeout is not a bug. Userspace timeouts are always defined to be at least. but what you

Re: [patch] change futex_wait() to hrtimers

2007-03-12 Thread Nick Piggin
On Mon, Mar 12, 2007 at 12:38:29PM +0100, Ingo Molnar wrote: * Nick Piggin [EMAIL PROTECTED] wrote: the issue is this: your fix reduces the effects of the bug but it is still fundamentally incomplete because of the use of timer_list. So But using schedule_timeout is not a bug.

Re: [patch] change futex_wait() to hrtimers

2007-03-12 Thread Ingo Molnar
* Nick Piggin [EMAIL PROTECTED] wrote: the issue is this: your fix reduces the effects of the bug but it is still fundamentally incomplete because of the use of timer_list. So But using schedule_timeout is not a bug. Userspace timeouts are always defined to be at least.

Re: [patch] change futex_wait() to hrtimers

2007-03-12 Thread Nick Piggin
On Mon, Mar 12, 2007 at 01:21:03PM +0100, Ingo Molnar wrote: * Nick Piggin [EMAIL PROTECTED] wrote: the issue is this: your fix reduces the effects of the bug but it is still fundamentally incomplete because of the use of timer_list. So But using schedule_timeout is

Re: [patch] change futex_wait() to hrtimers

2007-03-12 Thread Theodore Tso
On Mon, Mar 12, 2007 at 11:58:26AM +0100, Andi Kleen wrote: On Mon, Mar 12, 2007 at 12:00:20PM +0100, Thomas Gleixner wrote: On Mon, 2007-03-12 at 12:27 +0100, Andi Kleen wrote: Ingo Molnar [EMAIL PROTECTED] writes: the only correct approach is the use of hrtimers, and a patch

Re: [patch] change futex_wait() to hrtimers

2007-03-12 Thread Ingo Molnar
* Theodore Tso [EMAIL PROTECTED] wrote: What we probably need in the long-term, and not just for high precision wakeups, is we need a way for waiters (either in the kernel or in userspace) to specify a desired precision in their timers. Is it, wake me up in a second, exactly, or wake me

Re: [patch] change futex_wait() to hrtimers

2007-03-12 Thread Nick Piggin
On Mon, Mar 12, 2007 at 10:12:14AM -0400, Theodore Tso wrote: On Mon, Mar 12, 2007 at 11:58:26AM +0100, Andi Kleen wrote: On Mon, Mar 12, 2007 at 12:00:20PM +0100, Thomas Gleixner wrote: On Mon, 2007-03-12 at 12:27 +0100, Andi Kleen wrote: Ingo Molnar [EMAIL PROTECTED] writes:

Re: [patch] change futex_wait() to hrtimers

2007-03-12 Thread Andi Kleen
This becomes especially important if we want the tickless code to really shine as far as power management is concerned. Unfortunately, the POSIX timer abstraction doesn't give this kind of flexibility easily, so it's going to be a while before we see significant userspace adoption of such a