Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 9 Oct 2002 19:35:01 -0700
From:      Luigi Rizzo <rizzo@icir.org>
To:        Jeff Roberson <jeff@FreeBSD.ORG>
Cc:        arch@FreeBSD.ORG
Subject:   Re: Scheduler patch, ready for commit.
Message-ID:  <20021009193501.A55534@carp.icir.org>
In-Reply-To: <20021009211321.M23516-100000@mail.chesapeake.net>; from jeff@FreeBSD.ORG on Wed, Oct 09, 2002 at 09:17:18PM -0400
References:  <20021009211321.M23516-100000@mail.chesapeake.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Oct 09, 2002 at 09:17:18PM -0400, Jeff Roberson wrote:
> I haven't heard any objections to the goals of this patch.  I have cleaned
> it up and readied it for commit.  This step is important so that I can

well, you said you posted it just to get feedback, and now in 24 hours
you declare it "ready for commit". A bit rushing, aren't you!

I totally agree on the goals of the change (to abstract the scheduler
from the base system, generalise it, etc.), but it seems to me that
the specific details still need some cleanup before committing.
And, well, maybe leave a little bit more time to people to provide feedback!

So to come to the specific points:

  * there is one important API function which in my opinion is
    missing: -stable has a function, curpriority_cmp, which compares
    the priority of a currently running "thing" (process/thread)
    with that of a newly awaken one, and decises who has more right
    to get the CPU.

    In -current this is done inline (by comparing priorities),
    but this is very specific of the scheduler used there -- e.g.
    it doesn't  work for the scheduler used in -stable (where we have
    3 different classes for rtprio, normal and idlepri processes),
    and it does not work in general in cases where you could have
    different metrics to decide who is going to proceed.

  * Another API which should be made generic is forward_roundrobin().
    I believe the purpose of a "generic" version of this function
    is to dispatch a generic timeout to the appropriate CPU(s). In
    the FreeBSD's scheduler this timeout happens to be the roundrobin
    timeout, hence the name, but other schedulers (e.g. the one we
    wrote) have different timeout routines, and the dispatching
    requirements vary (e.g. could need to go to a single CPU as
    opposed to all cpus).

    On the same grounds, sched_rr_interval() is not generic,
    but specific for the freebsd scheduler. Not all schedulers
    have the concept of a roundrobin interval.

  * The other thing that i would really like to see is to
    call the scheduler functions through function pointers, so
    life is a lot easier when we will decide to enable kldloading of
    schedulers (or having multiple alternative ones).
    The way to implement it is trivial, see how we did in
    http://info.iet.unipi.it/~luigi/ps_sched.20020719a.diff.

Oh, another thing: struct proc (or struct thread, whatever it is
in -current)) contains some scheduler-specific information, such
as the priority fields.  Other schedulers might need different data
structures to work on. Given that this structure is something we
should not change lightly or frequently, it would be a good idea
to provide one (1) field (e.g. a void *) to be used by the scheduler
to reach a "scheduler extension" block from it. The way we provided
this extensibility in our scheduler framework (in -stable) was to
use some padding bytes in struct proc to store an integer which is
an index in an array of extended process descriptors, but that was
just a hack motivated by the need of not changing "struct proc".

Finally, thanks for working on this stuff!

	cheers
	luigi
----------------------------------+-----------------------------------------
 Luigi RIZZO, luigi@iet.unipi.it  . ICSI (on leave from Univ. di Pisa)
 http://www.iet.unipi.it/~luigi/  . 1947 Center St, Berkeley CA 94704
 Phone: (510) 666 2988
----------------------------------+-----------------------------------------

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?20021009193501.A55534>