From: Andrew Morton <andrewm@uow.edu.au>
To: Arthur Naseef <artn@home.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Kernel 2.2: tq_scheduler functions scheduling and waiting
Date: Tue, 29 May 2001 21:25:01 +1000 [thread overview]
Message-ID: <3B13870D.16B34800@uow.edu.au> (raw)
In-Reply-To: <3B13092F.F8AC6E92@uow.edu.au> <BGEHKJAIFDCFCMFALMGPEEHBCAAA.artn@home.com>
Arthur Naseef wrote:
>
> Andrew:
>
> Excellent. I will look at the 2.4 sources.
>
> In addition to the TASK_ZOMBIE issue you mention, I believe there
> is an issue of false termination of wait queues. Consider this:
>
> - Task places itself on a wait queue
> - Calls schedule()
> - tq_scheduler function does the same
>
> Now, there are two events which could place the task in TASK_RUNNING
> and no clear way to differentiate. And, since most of the kernel
> code does not check that the wait condition was actually met, this
> could lead to all types of problems, right?
>
Yes. The situation where one task is on two waitqueues
is rare, but does happen. And yes, there is code out there
which does a bare schedule() and *assumes* that once the
schedule has returned, the thing it was waiting for has
indeed occurred.
Generally this is poor practice - it's safer to loop
over the schedule() call until the condition you're
sleeping on has been tested.
You really shouldn't be sleeping in this way on tq_scheduler
if there's any way in which the sleep can take an extended
period of time. You may end up putting important kernel
tasks to sleep.
Best to use schedule_task(), or an independent kernel thread.
-
next prev parent reply other threads:[~2001-05-29 11:31 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-05-28 19:19 Kernel 2.2: tq_scheduler functions scheduling and waiting Arthur Naseef
2001-05-29 2:27 ` Andrew Morton
2001-05-29 11:21 ` Arthur Naseef
2001-05-29 11:25 ` Andrew Morton [this message]
2001-05-30 1:16 ` Arthur Naseef
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=3B13870D.16B34800@uow.edu.au \
--to=andrewm@uow.edu.au \
--cc=artn@home.com \
--cc=linux-kernel@vger.kernel.org \
/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