From owner-cvs-all@FreeBSD.ORG Sun Sep 5 02:09:55 2004 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 615AC16A4CE; Sun, 5 Sep 2004 02:09:55 +0000 (GMT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 41B5443D2F; Sun, 5 Sep 2004 02:09:55 +0000 (GMT) (envelope-from julian@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.11/8.12.11) with ESMTP id i8529ti2008739; Sun, 5 Sep 2004 02:09:55 GMT (envelope-from julian@repoman.freebsd.org) Received: (from julian@localhost) by repoman.freebsd.org (8.12.11/8.12.11/Submit) id i8529ttZ008738; Sun, 5 Sep 2004 02:09:55 GMT (envelope-from julian) Message-Id: <200409050209.i8529ttZ008738@repoman.freebsd.org> From: Julian Elischer Date: Sun, 5 Sep 2004 02:09:55 +0000 (UTC) To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org X-FreeBSD-CVS-Branch: HEAD Subject: cvs commit: src/sys/alpha/alpha machdep.c src/sys/amd64/amd64 machdep.c src/sys/arm/sa11x0 assabet_machdep.c src/sys/conf files src/sys/ddb db_ps.c src/sys/i386/i386 machdep.c src/sys/ia64/ia64 machdep.c src/sys/kern init_main.c kern_exec.c kern_exit.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: Sun, 05 Sep 2004 02:09:55 -0000 julian 2004-09-05 02:09:54 UTC FreeBSD src repository Modified files: sys/alpha/alpha machdep.c sys/amd64/amd64 machdep.c sys/arm/sa11x0 assabet_machdep.c sys/conf files sys/ddb db_ps.c sys/i386/i386 machdep.c sys/ia64/ia64 machdep.c sys/kern init_main.c kern_exec.c kern_exit.c kern_fork.c kern_intr.c kern_kse.c kern_proc.c kern_switch.c kern_synch.c kern_thr.c kern_thread.c sched_4bsd.c sched_ule.c sys/pc98/i386 machdep.c sys/powerpc/powerpc machdep.c sys/sparc64/sparc64 machdep.c sys/sys proc.h sched.h lib/libkvm kvm_proc.c Log: Refactor a bunch of scheduler code to give basically the same behaviour but with slightly cleaned up interfaces. The KSE structure has become the same as the "per thread scheduler private data" structure. In order to not make the diffs too great one is #defined as the other at this time. The KSE (or td_sched) structure is now allocated per thread and has no allocation code of its own. Concurrency for a KSEGRP is now kept track of via a simple pair of counters rather than using KSE structures as tokens. Since the KSE structure is different in each scheduler, kern_switch.c is now included at the end of each scheduler. Nothing outside the scheduler knows the contents of the KSE (aka td_sched) structure. The fields in the ksegrp structure that are to do with the scheduler's queueing mechanisms are now moved to the kg_sched structure. (per ksegrp scheduler private data structure). In other words how the scheduler queues and keeps track of threads is no-one's business except the scheduler's. This should allow people to write experimental schedulers with completely different internal structuring. A scheduler call sched_set_concurrency(kg, N) has been added that notifies teh scheduler that no more than N threads from that ksegrp should be allowed to be on concurrently scheduled. This is also used to enforce 'fainess' at this time so that a ksegrp with 10000 threads can not swamp a the run queue and force out a process with 1 thread, since the current code will not set the concurrency above NCPU, and both schedulers will not allow more than that many onto the system run queue at a time. Each scheduler should eventualy develop their own methods to do this now that they are effectively separated. Rejig libthr's kernel interface to follow the same code paths as linkse for scope system threads. This has slightly hurt libthr's performance but I will work to recover as much of it as I can. Thread exit code has been cleaned up greatly. exit and exec code now transitions a process back to 'standard non-threaded mode' before taking the next step. Reviewed by: scottl, peter MFC after: 1 week Revision Changes Path 1.80 +8 -1 src/lib/libkvm/kvm_proc.c 1.223 +1 -1 src/sys/alpha/alpha/machdep.c 1.620 +1 -1 src/sys/amd64/amd64/machdep.c 1.3 +1 -1 src/sys/arm/sa11x0/assabet_machdep.c 1.950 +1 -2 src/sys/conf/files 1.53 +5 -3 src/sys/ddb/db_ps.c 1.598 +1 -1 src/sys/i386/i386/machdep.c 1.186 +1 -1 src/sys/ia64/ia64/machdep.c 1.248 +8 -21 src/sys/kern/init_main.c 1.250 +2 -6 src/sys/kern/kern_exec.c 1.246 +2 -17 src/sys/kern/kern_exit.c 1.238 +2 -11 src/sys/kern/kern_fork.c 1.115 +1 -0 src/sys/kern/kern_intr.c 1.200 +57 -36 src/sys/kern/kern_kse.c 1.216 +10 -28 src/sys/kern/kern_proc.c 1.86 +184 -97 src/sys/kern/kern_switch.c 1.259 +3 -3 src/sys/kern/kern_synch.c 1.25 +56 -103 src/sys/kern/kern_thr.c 1.196 +153 -241 src/sys/kern/kern_thread.c 1.57 +116 -63 src/sys/kern/sched_4bsd.c 1.125 +163 -108 src/sys/kern/sched_ule.c 1.343 +1 -1 src/sys/pc98/i386/machdep.c 1.76 +1 -1 src/sys/powerpc/powerpc/machdep.c 1.113 +1 -1 src/sys/sparc64/sparc64/machdep.c 1.399 +21 -93 src/sys/sys/proc.h 1.16 +10 -13 src/sys/sys/sched.h