[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <485B50F1.2020802@gmail.com>
Date: Fri, 20 Jun 2008 08:40:49 +0200
From: Jiri Slaby <jirislaby@...il.com>
To: Roland Dreier <rdreier@...co.com>
CC: linux-kernel@...r.kernel.org, mingo@...e.hu,
Eli Cohen <eli@....mellanox.co.il>,
general@...ts.openfabrics.org
Subject: Re: wait_for_completion_timeout() spurious failure under heavy load?
Roland Dreier napsal(a):
> It seems that the current implementaton of wait_for_completion_timeout()
> has a small problem under very high load for the common pattern:
>
> if (!wait_for_completion_timeout(&done, timeout))
> /* handle failure */
>
> because the implementation very roughly does (lots of code deleted to
> show the basic flow):
>
> static inline long __sched
> do_wait_for_common(struct completion *x, long timeout, int state)
> {
> if (x->done)
> return timeout;
>
> do {
> timeout = schedule_timeout(timeout);
>
> if (!timeout)
> return timeout;
>
> } while (!x->done);
>
> return timeout;
> }
>
> so if the system is very busy and x->done is not set when
> do_wait_for_common() is entered, it is possible that the first call to
> schedule_timeout() returns 0 because the task doing wait_for_completion
Sorry, but how can schedule_timeout return 0 before the timeout expiration?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists