From owner-cvs-all Tue Jul 30 2:37:47 2002 Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8DDD737B400; Tue, 30 Jul 2002 02:37:41 -0700 (PDT) Received: from silver.carrots.uucp.r.dl.itc.u-tokyo.ac.jp (IP1A0644.kng.mesh.ad.jp [211.13.34.138]) by mx1.FreeBSD.org (Postfix) with ESMTP id CAAF043E6A; Tue, 30 Jul 2002 02:37:39 -0700 (PDT) (envelope-from tanimura@r.dl.itc.u-tokyo.ac.jp) Received: from silver.carrots.uucp.r.dl.itc.u-tokyo.ac.jp (localhost [127.0.0.1]) by silver.carrots.uucp.r.dl.itc.u-tokyo.ac.jp (8.12.5/3.7W-carrots-Keikyu-Kurihama) with ESMTP id g6U9axhh075462 ; Tue, 30 Jul 2002 18:37:11 +0900 (JST) Message-Id: <200207300937.g6U9axhh075462@silver.carrots.uucp.r.dl.itc.u-tokyo.ac.jp> Date: Tue, 30 Jul 2002 18:36:59 +0900 From: Seigo Tanimura To: David Xu Cc: Seigo Tanimura , cvs-committers@FreeBSD.ORG, cvs-all@FreeBSD.ORG Subject: Re: cvs commit: src/sys/kern kern_condvar.c kern_switch.c kern_synch.c src/sys/sys proc.h src/sys/vm vm_glue.c In-Reply-To: <200207301650.44420.davidx@viasoft.com.cn> References: <200207300654.g6U6s5tY099740@freefall.freebsd.org> <200207301612.55467.davidx@viasoft.com.cn> <200207300826.g6U8Q9hh055075@silver.carrots.uucp.r.dl.itc.u-tokyo.ac.jp> <200207301650.44420.davidx@viasoft.com.cn> User-Agent: Wanderlust/2.8.1 (Something) SEMI/1.14.3 (Ushinoya) FLIM/1.14.3 (=?ISO-8859-1?Q?Unebigory=F2mae?=) APEL/10.3 MULE XEmacs/21.1 (patch 14) (Cuyahoga Valley) (i386--freebsd) Organization: Digital Library Research Division, Information Techinology Centre, The University of Tokyo MIME-Version: 1.0 (generated by SEMI 1.14.3 - "Ushinoya") Content-Type: text/plain; charset=US-ASCII Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Tue, 30 Jul 2002 16:50:44 +0800, David Xu said: David> Yes, and how about cv_abort()? If a thread is in TDS_SLP, it should be all right. setrunnable() wakes up the scheduler thread. Otherwise, the thread is likely to be suspended by thread_single(). This should not be a problem as well because a process with a suspended thread is not swapped out. (see thread_safetoswapout() in sys/proc.h) David> On Tuesday 30 July 2002 16:26, Seigo Tanimura wrote: >> On Tue, 30 Jul 2002 16:12:55 +0800, >> David Xu 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. >> >> The rest of endtsleep() should be all right, setrunnable() takes care >> of a thread swapped out. >> David> On Tuesday 30 July 2002 14:54, Seigo Tanimura wrote: >> >> tanimura 2002/07/29 23:54:05 PDT >> >> >> >> Modified files: >> >> sys/kern kern_condvar.c kern_switch.c kern_synch.c >> >> sys/sys proc.h >> >> sys/vm vm_glue.c >> >> Log: >> >> - Optimize wakeup() and its friends; if a thread waken up is being >> >> swapped in, we do not have to ask for the scheduler thread to do >> >> that. >> >> >> >> - Assert that a process is not swapped out in runq functions and >> >> swapout(). >> >> >> >> - Introduce thread_safetoswapout() for readability. >> >> >> >> - In swapout_procs(), perform a test that may block (check of a >> >> thread working on its vm map) first. This lets us call swapout() >> >> with the sched_lock held, providing a better atomicity. >> >> >> >> Revision Changes Path >> >> 1.27 +4 -2 src/sys/kern/kern_condvar.c >> >> 1.35 +6 -0 src/sys/kern/kern_switch.c >> >> 1.191 +12 -6 src/sys/kern/kern_synch.c >> >> 1.233 +5 -0 src/sys/sys/proc.h >> >> 1.150 +65 -64 src/sys/vm/vm_glue.c >> >> >> >> To Unsubscribe: send mail to majordomo@FreeBSD.org >> >> with "unsubscribe cvs-all" in the body of the message >> >> To Unsubscribe: send mail to majordomo@FreeBSD.org >> with "unsubscribe cvs-all" in the body of the message To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message