diff options
author | Pierre Peiffer <pierre.peiffer@bull.net> | 2007-05-09 05:35:02 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-09 15:30:55 -0400 |
commit | c19384b5b296905d4988c7c684ff540a0f9d65be (patch) | |
tree | 071cfe0855d409d63de80ec1b9b663738efb09de /include/linux/futex.h | |
parent | ec92d08292d3e9b0823eba138a4564d2d39f25c7 (diff) |
Make futex_wait() use an hrtimer for timeout
This patch modifies futex_wait() to use an hrtimer + schedule() in place of
schedule_timeout().
schedule_timeout() is tick based, therefore the timeout granularity is the
tick (1 ms, 4 ms or 10 ms depending on HZ). By using a high resolution timer
for timeout wakeup, we can attain a much finer timeout granularity (in the
microsecond range). This parallels what is already done for futex_lock_pi().
The timeout passed to the syscall is no longer converted to jiffies and is
therefore passed to do_futex() and futex_wait() as an absolute ktime_t
therefore keeping nanosecond resolution.
Also this removes the need to pass the nanoseconds timeout part to
futex_lock_pi() in val2.
In futex_wait(), if there is no timeout then a regular schedule() is
performed. Otherwise, an hrtimer is fired before schedule() is called.
[akpm@linux-foundation.org: fix `make headers_check']
Signed-off-by: Sebastien Dugue <sebastien.dugue@bull.net>
Signed-off-by: Pierre Peiffer <pierre.peiffer@bull.net>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Ulrich Drepper <drepper@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/futex.h')
-rw-r--r-- | include/linux/futex.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/include/linux/futex.h b/include/linux/futex.h index 820125c628c1..34e54f2b8997 100644 --- a/include/linux/futex.h +++ b/include/linux/futex.h | |||
@@ -3,6 +3,8 @@ | |||
3 | 3 | ||
4 | #include <linux/sched.h> | 4 | #include <linux/sched.h> |
5 | 5 | ||
6 | union ktime; | ||
7 | |||
6 | /* Second argument to futex syscall */ | 8 | /* Second argument to futex syscall */ |
7 | 9 | ||
8 | 10 | ||
@@ -94,7 +96,7 @@ struct robust_list_head { | |||
94 | #define ROBUST_LIST_LIMIT 2048 | 96 | #define ROBUST_LIST_LIMIT 2048 |
95 | 97 | ||
96 | #ifdef __KERNEL__ | 98 | #ifdef __KERNEL__ |
97 | long do_futex(u32 __user *uaddr, int op, u32 val, unsigned long timeout, | 99 | long do_futex(u32 __user *uaddr, int op, u32 val, union ktime *timeout, |
98 | u32 __user *uaddr2, u32 val2, u32 val3); | 100 | u32 __user *uaddr2, u32 val2, u32 val3); |
99 | 101 | ||
100 | extern int | 102 | extern int |