From owner-cvs-all@FreeBSD.ORG Wed Apr 2 17:23:42 2003 Return-Path: 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 B601737B401; Wed, 2 Apr 2003 17:23:42 -0800 (PST) Received: from canning.wemm.org (canning.wemm.org [192.203.228.65]) by mx1.FreeBSD.org (Postfix) with ESMTP id 07D1643FDD; Wed, 2 Apr 2003 17:23:41 -0800 (PST) (envelope-from peter@wemm.org) Received: from wemm.org (localhost [127.0.0.1]) by canning.wemm.org (Postfix) with ESMTP id B55B32A8A7; Wed, 2 Apr 2003 17:23:41 -0800 (PST) (envelope-from peter@wemm.org) X-Mailer: exmh version 2.5 07/13/2001 with nmh-1.0.4 To: Nate Lawson In-Reply-To: Date: Wed, 02 Apr 2003 17:23:41 -0800 From: Peter Wemm Message-Id: <20030403012341.B55B32A8A7@canning.wemm.org> cc: cvs-src@FreeBSD.org cc: src-committers@FreeBSD.org cc: cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/conf options.i386 src/sys/i386/i386 machdep.c mp_machdep.c pmap.c swtch.s src/sys/i386/include md_var.h pmap.h smp.h src/sys/i386/isa apic_vector.s intr_machdep.h src/sys/kern kern_switch.c kern_synch.c kern_thr.c kern_thread.c subr_witness.c ... X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Apr 2003 01:23:43 -0000 Nate Lawson wrote: > On Wed, 2 Apr 2003, Peter Wemm wrote: > > Commit a partial lazy thread switch mechanism for i386. it isn't as lazy > > as it could be and can do with some more cleanup. Currently its under > > options LAZY_SWITCH. What this does is avoid %cr3 reloads for short > > context switches that do not involve another user process. > > This is awesome! > > > One non-trivial change was to select a new thread before calling > > cpu_switch() in the first place. This allows us to catch the silly > > case of doing a cpu_switch() to the current process. This happens > > uncomfortably often. This simplifies a bit of the asm code in cpu_switch > > (no longer have to call choosethread() in the middle). This has been > > implemented on i386 and (thanks to jake) sparc64. The others will come > > soon. This is actually seperate to the lazy switch stuff. > > Shouldn't there be a "if (thread == curthread) return;" in the scheduling > code somewhere? There is now. :-) newtd = choosethread(); if (td != newtd) cpu_switch(td, newtd); /* SHAZAM!! */ #ifdef SWTCH_OPTIM_STATS else stupid_switch++; #endif sparc64's cpu_switch() already optimized this case. i386 didn't. I haven't checked alpha/ia64 yet, but they're still using the old no-args API. > -Nate > Cheers, -Peter -- Peter Wemm - peter@wemm.org; peter@FreeBSD.org; peter@yahoo-inc.com "All of this is for nothing if we don't go to the stars" - JMS/B5