From owner-freebsd-arch Wed Jul 17 6:23:19 2002 Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2593A37B400 for ; Wed, 17 Jul 2002 06:23:15 -0700 (PDT) Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1D0AA43E31 for ; Wed, 17 Jul 2002 06:23:14 -0700 (PDT) (envelope-from bde@zeta.org.au) Received: from bde.zeta.org.au (bde.zeta.org.au [203.2.228.102]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id XAA12981; Wed, 17 Jul 2002 23:23:04 +1000 Date: Wed, 17 Jul 2002 23:26:49 +1000 (EST) From: Bruce Evans X-X-Sender: bde@gamplex.bde.org To: Luigi Rizzo Cc: arch@FreeBSD.ORG Subject: Re: proposed changes to kern_switch.c and kern_synch.c In-Reply-To: <20020716235216.B6785@iguana.icir.org> Message-ID: <20020717223904.J5141-100000@gamplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Tue, 16 Jul 2002, Luigi Rizzo wrote: > we have implemented a weight-based process scheduler > for FreeBSD-stable, and are trying to port it to -current (in the > description below replace "process" with "thread/kse" as appropriate > for the -current case). > > In order to make this work, it is convenient to have all > scheduler-specific functions and data structures in a > single file (kern_switch*.c), and generic support in > another one (kern_synch.c). I believe this was also the original > BSD design in partitioning the code between the two files. > However, in our current code, there are some functions which > are scheduler-specific (see below) which are misplaced. This move would be sort of backwards IMO. As has been pointed out, the original BSD design is nothing like that. Almost everything related to scheduling was in kern_synch.c. I think of kern_synch.c is being mainly for scheduling (and sleeping), and wouldn't like to see the scheduling stuff moved out of it, especially to kern_switch.c. Moving mi_switch() to kern_switch.c would be OK. My viewpoint may be colored by having 902 lines of diffs (-c2) for kern_synch.c including about 100 lines of bug fixes and 300 lines of scheduler changes. (Latest breakage: running processes are classified as sleeping and not scheduled. Scheduling is not very important, so even huge bugs like this go unnoticed.) > So I would like to make the following, purely cosmetic, change > identified as step #1 below, both for consistency with what i > believe to be the original design, and to simplify further work > in this area. These would go to both -current and -stable; I > repeat, they are only cosmetic changes. > ... > Step #1 is basically a cosmetic change, requiring mostly a move of > some functions from kern_synch.c to kern_switch.c. These are > > roundrobin(); > > curpriority_cmp(); curpriority_cmp() doesn't exist in -current and shouldn't be reintroduced. It is part of maybe_resched() in -current. I think that this function and most of the things now in kern_switch.c should not be scheduler-dependent. Each scheduler can manage priorities and let common code choose the process with highest priority. If you want a different priority scheme then you would need to change much more, especially in -current where there is priority-propagation stuff that depends on linear priorities to work. > > resetpriority(); > > parts of schedcpu() and schedclock(); Why not all of these functions? schedcpu() is almost empty after the move. Each scheduler can easily duplicate this part (or maybe not have it). Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message