Messages in this thread Patch in this message | | | Date | Tue, 19 Oct 2004 18:26:11 +0200 | From | Ingo Molnar <> | Subject | Re: [patch] Real-Time Preemption, -RT-2.6.9-rc4-mm1-U6 |
| |
* Thomas Gleixner <tglx@linutronix.de> wrote:
> On Tue, 2004-10-19 at 16:46, Ingo Molnar wrote: > > * Ingo Molnar <mingo@elte.hu> wrote: > > i've re-released the patch because shortly after releasing it i found a > > false-positive in the deadlock-detector that was triggering in oowriter. > > Hit and converted another one. There are more, but they need more > modifications as they don't have a condition to wait for and therefor > must be converted to use the completion API, which must be extended to > provide completion_timemout() first.
thanks, i've applied your patch to my tree. Find below an untested implementation of wait_for_completion_timeout().
Ingo
--- linux/kernel/sched.c.orig +++ linux/kernel/sched.c @@ -3070,6 +3148,31 @@ void fastcall __sched wait_for_completio } EXPORT_SYMBOL(wait_for_completion); +unsigned long fastcall __sched +wait_for_completion_timeout(struct completion *x, unsigned long timeout) +{ + might_sleep(); + spin_lock_irq(&x->wait.lock); + if (!x->done) { + DECLARE_WAITQUEUE(wait, current); + + wait.flags |= WQ_FLAG_EXCLUSIVE; + __add_wait_queue_tail(&x->wait, &wait); + do { + __set_current_state(TASK_UNINTERRUPTIBLE); + spin_unlock_irq(&x->wait.lock); + timeout = schedule_timeout(timeout); + spin_lock_irq(&x->wait.lock); + } while (!x->done); + __remove_wait_queue(&x->wait, &wait); + } + x->done--; + spin_unlock_irq(&x->wait.lock); + + return timeout; +} +EXPORT_SYMBOL(wait_for_completion_timeout); + #define SLEEP_ON_VAR \ unsigned long flags; \ wait_queue_t wait; \ --- linux/include/linux/completion.h.orig +++ linux/include/linux/completion.h @@ -28,6 +28,8 @@ static inline void init_completion(struc } extern void FASTCALL(wait_for_completion(struct completion *)); +extern unsigned long FASTCALL(wait_for_completion_timeout(struct completion *, + unsigned long)); extern void FASTCALL(complete(struct completion *)); extern void FASTCALL(complete_all(struct completion *)); - 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/
| |