From owner-cvs-src@FreeBSD.ORG Wed Apr 2 15:53:31 2003 Return-Path: Delivered-To: cvs-src@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6C4A137B401; Wed, 2 Apr 2003 15:53:31 -0800 (PST) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id F06D543FAF; Wed, 2 Apr 2003 15:53:30 -0800 (PST) (envelope-from peter@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.6/8.12.6) with ESMTP id h32NrU0U042514; Wed, 2 Apr 2003 15:53:30 -0800 (PST) (envelope-from peter@repoman.freebsd.org) Received: (from peter@localhost) by repoman.freebsd.org (8.12.6/8.12.6/Submit) id h32NrUVZ042513; Wed, 2 Apr 2003 15:53:30 -0800 (PST) Message-Id: <200304022353.h32NrUVZ042513@repoman.freebsd.org> From: Peter Wemm Date: Wed, 2 Apr 2003 15:53:30 -0800 (PST) To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org X-FreeBSD-CVS-Branch: HEAD Subject: 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... X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Apr 2003 23:53:32 -0000 peter 2003/04/02 15:53:30 PST FreeBSD src repository Modified files: sys/conf options.i386 sys/i386/i386 machdep.c mp_machdep.c pmap.c swtch.s sys/i386/include md_var.h pmap.h smp.h sys/i386/isa apic_vector.s intr_machdep.h sys/kern kern_switch.c kern_synch.c kern_thr.c kern_thread.c subr_witness.c sys/sparc64/sparc64 mp_machdep.c swtch.S sys/sys proc.h Log: 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. ie: we can take an interrupt, switch to a kthread and return to the user without explicitly flushing the tlb. However, this isn't as exciting as it could be, the interrupt overhead is still high and too much blocks on Giant still. There are some debug sysctls, for stats and for an on/off switch. The main problem with doing this has been "what if the process that you're running on exits while we're borrowing its address space?" - in this case we use an IPI to give it a kick when we're about to reclaim the pmap. Its not compiled in unless you add the LAZY_SWITCH option. I want to fix a few more things and get some more feedback before turning it on by default. This is NOT a replacement for Bosko's lazy interrupt stuff. This was more meant for the kthread case, while his was for interrupts. Mine helps a little for interrupts, but his helps a lot more. The stats are enabled with options SWTCH_OPTIM_STATS - this has been a pseudo-option for years, I just added a bunch of stuff to it. 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. Glanced at by: jake, jhb Revision Changes Path 1.188 +2 -0 src/sys/conf/options.i386 1.561 +33 -3 src/sys/i386/i386/machdep.c 1.207 +8 -1 src/sys/i386/i386/mp_machdep.c 1.402 +128 -1 src/sys/i386/i386/pmap.c 1.136 +112 -78 src/sys/i386/i386/swtch.s 1.61 +16 -0 src/sys/i386/include/md_var.h 1.94 +1 -1 src/sys/i386/include/pmap.h 1.76 +1 -0 src/sys/i386/include/smp.h 1.87 +22 -0 src/sys/i386/isa/apic_vector.s 1.43 +5 -1 src/sys/i386/isa/intr_machdep.h 1.57 +17 -1 src/sys/kern/kern_switch.c 1.217 +23 -3 src/sys/kern/kern_synch.c 1.3 +4 -0 src/sys/kern/kern_thr.c 1.112 +6 -0 src/sys/kern/kern_thread.c 1.150 +6 -0 src/sys/kern/subr_witness.c 1.20 +1 -1 src/sys/sparc64/sparc64/mp_machdep.c 1.26 +12 -14 src/sys/sparc64/sparc64/swtch.S 1.311 +5 -0 src/sys/sys/proc.h