From owner-freebsd-current@FreeBSD.ORG Mon Oct 11 13:05:06 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 9EDBC16A4CE; Mon, 11 Oct 2004 13:05:06 +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 DFEE643D48; Mon, 11 Oct 2004 13:05:04 +0000 (GMT) (envelope-from boris@brooknet.com.au) Received: from ppp251E.dyn.pacific.net.au (ppp251E.dyn.pacific.net.au [61.8.37.30])i9BD1t1n032610; Mon, 11 Oct 2004 23:01:56 +1000 From: Sam Lawrance To: Robert Watson In-Reply-To: References: Content-Type: text/plain Date: Mon, 11 Oct 2004 23:07:32 +1000 Message-Id: <1097500052.2797.10.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 cc: David Xu Subject: Re: Noticable Delays Since Beta 3 (possible cause) 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: Mon, 11 Oct 2004 13:05:06 -0000 Folks, On Mon, 2004-10-11 at 04:55 -0400, Robert Watson wrote: > On Sat, 9 Oct 2004, Sam Lawrance wrote: > > > I'm sorry, that patch was missing paths.. this one: > > > > http://sam.stral.net/freebsd/wakeupdelay-patch > > > > is much nicer. > > Are there plans to get this patch merged for 5.3? I was chatting with > Brian yesterday about the accept locking issue in sofree() and he was > indicating that he was seeing symptoms very much like the ones described > in this thread (long wakeup times for keypresses, etc). I just noticed that the messages David sent to me and the list have yet to make it through to the list. One was a patch which puts the wakeup in the critical_exit where he suggested (but I didn't understand :). Here it is: Index: sys/proc.h =================================================================== RCS file: /home/ncvs/src/sys/sys/proc.h,v retrieving revision 1.409 diff -u -r1.409 proc.h --- sys/proc.h 6 Oct 2004 00:40:40 -0000 1.409 +++ sys/proc.h 9 Oct 2004 10:59:50 -0000 @@ -369,7 +369,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 /* Wants 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 */ Index: kern/kern_switch.c =================================================================== RCS file: /home/ncvs/src/sys/kern/kern_switch.c,v retrieving revision 1.97 diff -u -r1.97 kern_switch.c --- kern/kern_switch.c 5 Oct 2004 22:03:10 -0000 1.97 +++ kern/kern_switch.c 9 Oct 2004 10:59:50 -0000 @@ -449,6 +449,10 @@ KASSERT(td->td_critnest != 0, ("critical_exit: td_critnest == 0")); if (td->td_critnest == 1) { + if (td->td_pflags & TDP_WAKEPROC0) { + td->td_pflags &= ~TDP_WAKEPROC0; + wakeup(&proc0); + } #ifdef PREEMPTION mtx_assert(&sched_lock, MA_NOTOWNED); if (td->td_pflags & TDP_OWEPREEMPT) { Index: kern/kern_synch.c =================================================================== RCS file: /home/ncvs/src/sys/kern/kern_synch.c,v retrieving revision 1.262 diff -u -r1.262 kern_synch.c --- kern/kern_synch.c 5 Oct 2004 18:51:11 -0000 1.262 +++ kern/kern_synch.c 9 Oct 2004 10:59:51 -0000 @@ -390,13 +390,13 @@ 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. + * due to a LOR between sched_lock and + * the sleepqueue chain locks, delay + * wakeup proc0 until thread leaves + * critical region. */ - wakeup(&proc0); -#endif + curthread->td_pflags |= TDP_WAKEPROC0; } } else sched_wakeup(td);