From: Jiri Slaby <jirislaby@gmail.com>
To: Roland Dreier <rdreier@cisco.com>
Cc: linux-kernel@vger.kernel.org, mingo@elte.hu,
Eli Cohen <eli@dev.mellanox.co.il>,
general@lists.openfabrics.org
Subject: Re: wait_for_completion_timeout() spurious failure under heavy load?
Date: Fri, 20 Jun 2008 08:40:49 +0200 [thread overview]
Message-ID: <485B50F1.2020802@gmail.com> (raw)
In-Reply-To: <ada63s5w088.fsf@cisco.com>
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?
next prev parent reply other threads:[~2008-06-20 6:41 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-19 22:04 wait_for_completion_timeout() spurious failure under heavy load? Roland Dreier
2008-06-20 6:40 ` Jiri Slaby [this message]
2008-06-20 11:20 ` Ingo Molnar
2008-06-20 11:30 ` Peter Zijlstra
2008-06-20 14:14 ` Oleg Nesterov
2008-06-20 14:32 ` Oleg Nesterov
2008-06-20 15:21 ` Ingo Molnar
2008-06-20 14:33 ` Roland Dreier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=485B50F1.2020802@gmail.com \
--to=jirislaby@gmail.com \
--cc=eli@dev.mellanox.co.il \
--cc=general@lists.openfabrics.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=rdreier@cisco.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox