From owner-freebsd-current@FreeBSD.ORG Sat Oct 9 06:35:19 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id EF34D16A4CE; Sat, 9 Oct 2004 06:35:19 +0000 (GMT) Received: from bloodwood.hunterlink.net.au (smtp-local.hunterlink.net.au [203.12.144.17]) by mx1.FreeBSD.org (Postfix) with ESMTP id 421BE43D39; Sat, 9 Oct 2004 06:35:18 +0000 (GMT) (envelope-from boris@brooknet.com.au) Received: from ppp2F9A.dyn.pacific.net.au (ppp2F9A.dyn.pacific.net.au [61.8.47.154])i996WMaU018227; Sat, 9 Oct 2004 16:32:23 +1000 From: Sam Lawrance To: David Xu In-Reply-To: <41676B9B.8090507@freebsd.org> References: <4164BFA4.80105@unisa.edu.au> <41657D63.1050605@FreeBSD.org> <1097290576.836.20.camel@dirk.no.domain> <200410082346.16570.marc.ramirez@bluecirclesoft.com> <41676B9B.8090507@freebsd.org> Content-Type: text/plain Date: Sat, 09 Oct 2004 16:37:44 +1000 Message-Id: <1097303864.806.6.camel@dirk.no.domain> Mime-Version: 1.0 X-Mailer: Evolution 2.0.1FreeBSD GNOME Team Port Content-Transfer-Encoding: 7bit cc: freebsd-current@freebsd.org Subject: Re: Noticable Delays Since Beta 3 (patch) X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Oct 2004 06:35:20 -0000 On Sat, 2004-10-09 at 12:39 +0800, David Xu wrote: > This can be done by set a flag in current threads td_pflags, > for example, set TDP_WAKEPROC0, when the current thread > leaves critical region, it can do wakeup(&proc0); This is working for me against 5.3-BETA5. Index: kern_synch.c =================================================================== RCS file: /home/ncvs/FreeBSD/src/sys/kern/kern_synch.c,v retrieving revision 1.257.2.3 diff -u -u -r1.257.2.3 kern_synch.c --- kern_synch.c 18 Sep 2004 04:11:35 -0000 1.257.2.3 +++ kern_synch.c 9 Oct 2004 05:52:05 -0000 @@ -249,8 +249,14 @@ wakeup(ident) register void *ident; { + struct thread *td = curthread; sleepq_broadcast(ident, SLEEPQ_MSLEEP, -1); + /* If swapped out processes were awakened bring them in */ + if (td->td_pflags & TDP_WAKEPROC0) { + td->td_pflags &= ~TDP_WAKEPROC0; + sleepq_broadcast(&proc0, SLEEPQ_MSLEEP, -1); + } } /* @@ -360,6 +366,7 @@ setrunnable(struct thread *td) { struct proc *p; + struct thread *ctd = curthread; p = td->td_proc; mtx_assert(&sched_lock, MA_OWNED); @@ -390,13 +397,7 @@ if ((p->p_sflag & PS_INMEM) == 0) { if ((p->p_sflag & PS_SWAPPINGIN) == 0) { p->p_sflag |= PS_SWAPINREQ; -#ifndef SMP - /* - * XXX: Disabled on SMP due to a LOR between - * sched_lock and the sleepqueue chain locks. - */ - wakeup(&proc0); -#endif + ctd->td_pflags |= TDP_WAKEPROC0; } } else sched_wakeup(td); Index: proc.h =================================================================== RCS file: /home/ncvs/FreeBSD/src/sys/sys/proc.h,v retrieving revision 1.392.2.9 diff -u -u -r1.392.2.9 proc.h --- proc.h 18 Sep 2004 04:11:35 -0000 1.392.2.9 +++ proc.h 9 Oct 2004 05:54:40 -0000 @@ -370,7 +370,7 @@ #define TDP_SA 0x00000080 /* A scheduler activation based thread. */ #define TDP_OWEPREEMPT 0x00000100 /* Thread has a pending preemption. */ #define TDP_OWEUPC 0x00000200 /* Call addupc() at next AST. */ -#define TDP_UNUSED10 0x00000400 /* -- available-- */ +#define TDP_WAKEPROC0 0x00000400 /* Want caller to wakeup(&proc0) */ #define TDP_CAN_UNBIND 0x00000800 /* Only temporarily bound. */ #define TDP_SCHED1 0x00001000 /* Reserved for scheduler private use */ #define TDP_SCHED2 0x00002000 /* Reserved for scheduler private use */