Date: Sat, 09 Oct 2004 16:37:44 +1000 From: Sam Lawrance <boris@brooknet.com.au> To: David Xu <davidxu@freebsd.org> Cc: freebsd-current@freebsd.org Subject: Re: Noticable Delays Since Beta 3 (patch) Message-ID: <1097303864.806.6.camel@dirk.no.domain> 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>
next in thread | previous in thread | raw e-mail | index | archive | help
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 */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1097303864.806.6.camel>