Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 30 Jul 2002 09:48:17 -0400 (EDT)
From:      John Baldwin <jhb@FreeBSD.org>
To:        Seigo Tanimura <tanimura@r.dl.itc.u-tokyo.ac.jp>
Cc:        cvs-all@FreeBSD.ORG, cvs-committers@FreeBSD.ORG, Seigo Tanimura <tanimura@FreeBSD.ORG>, David Xu <davidx@viasoft.com.cn>
Subject:   Re: cvs commit: src/sys/kern kern_condvar.c kern_switch.c kern_s
Message-ID:  <XFMail.20020730094817.jhb@FreeBSD.org>
In-Reply-To: <200207300826.g6U8Q9hh055075@silver.carrots.uucp.r.dl.itc.u-tokyo.ac.jp>

next in thread | previous in thread | raw e-mail | index | archive | help

On 30-Jul-2002 Seigo Tanimura wrote:
> On Tue, 30 Jul 2002 16:12:55 +0800,
>   David Xu <davidx@viasoft.com.cn> said:
> 
> David> could you look carefully timeout handing function? for example,
> David> cv_timedwait_end(), it has same problem with swapping.
> 
> Do you mean, for instance, this fragment?
> 
> [sys/kern/kern_synch.c]
> static void
> endtsleep(arg)
>         void *arg;
> {
> (snip)
>         if ((td->td_flags & TDF_TIMEOUT) != 0) {
>                 td->td_flags &= ~TDF_TIMEOUT;
>                 setrunqueue(td); /* <- XXX! */
> 
> Yes, as the state of the thread in question is TDS_SLP, it can be
> swapped out.

That state is wrong.  We are not on a sleep queue.  We are about to be
woken up again by another CPU (the timeout has to be running on another
CPU for this code to be executing) so we should not be swapped out while
we are waiting to be resumed.

-- 

John Baldwin <jhb@FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve!"  -  http://www.FreeBSD.org/

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.20020730094817.jhb>