From owner-freebsd-current@FreeBSD.ORG Sat Oct 9 02:53:54 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 64FA916A4E3; Sat, 9 Oct 2004 02:53:54 +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 B722343D31; Sat, 9 Oct 2004 02:53:52 +0000 (GMT) (envelope-from boris@brooknet.com.au) Received: from ppp2164.dyn.pacific.net.au (ppp2164.dyn.pacific.net.au [61.8.33.100])i992otDa020350; Sat, 9 Oct 2004 12:50:57 +1000 From: Sam Lawrance To: Scott Long In-Reply-To: <41657D63.1050605@FreeBSD.org> References: <4164BFA4.80105@unisa.edu.au> <41657D63.1050605@FreeBSD.org> Content-Type: text/plain Date: Sat, 09 Oct 2004 12:56:16 +1000 Message-Id: <1097290576.836.20.camel@dirk.no.domain> Mime-Version: 1.0 X-Mailer: Evolution 2.0.1FreeBSD GNOME Team Port Content-Transfer-Encoding: 7bit cc: Benjamin Close cc: freebsd-current@freebsd.org 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: Sat, 09 Oct 2004 02:53:54 -0000 On Thu, 2004-10-07 at 11:31 -0600, Scott Long wrote: > Doug White wrote: > > On Thu, 7 Oct 2004, Benjamin Close wrote: > > > > > >> I've been using each Beta Release as they come out and ever since > >>Beta 3 I've noticed delays where there never used to be any. > >>I believe this may be somehow related to ULE->BSD scheduler change. A > >>classic situation of where they now exist is when I switch virtual > >>desktops back to another xterm. It takes 4-5 seconds before I can type. > >>The machine is virtually 100% idle. Before beta3 this was not a problem > >>with almost an instant response. > > > > > > Can you provide a reproduction case? I don't notice any sort of delay when > > switching between text vtys, or changing keyboard focus in X. I've been > > using 4BSD the entire time. > > > > Are you switching between X and text vty's? There's always been a delay > > there, worse on my amd64 box than i386, but I don't do that regularly; > > much easier to just pop another xterm :) > > I think I've found the cause of the delays. The problem was consistently reproducible with getty processes which are swapped out (ie 'ps' shows RSS=0 and state=IWs+). Since the problem was identifiable when starting to type at a vty, I traced the problem back through: ttyinput() : tty.c ttwakeup() : tty.c wakeup() : kern_synch.c sleepq_broadcast() : subr_sleepq.c sleepq_resume_thread() : subr_sleepq.c setrunnable() : kern_synch.c Notice in setrunnable() how wakeup(&proc0) is wrapped by #ifndef SMP? This means that scheduler() : vm/vm_glue.c, which tsleeps on proc0, is not awoken to traverse the process list and swap the process in. scheduler() tsleeps for a maximum of maxslp * hz / 2. maxslp on all archs appears to be 20, so the actual wakeup intended by ttwakeup() may not occur for up to 10 seconds.