Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 17 Jul 2002 23:26:49 +1000 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Luigi Rizzo <rizzo@icir.org>
Cc:        arch@FreeBSD.ORG
Subject:   Re: proposed changes to kern_switch.c and kern_synch.c
Message-ID:  <20020717223904.J5141-100000@gamplex.bde.org>
In-Reply-To: <20020716235216.B6785@iguana.icir.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020717223904.J5141-100000>