Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 Dec 2011 23:59:54 +0100
From:      Luigi Rizzo <rizzo@iet.unipi.it>
To:        Doug Barton <dougb@FreeBSD.org>
Cc:        freebsd-stable@freebsd.org, Michel Talon <talon@lpthe.jussieu.fr>
Subject:   Re: switching schedulers (Re: SCHED_ULE should not be the default)
Message-ID:  <20111216225954.GA83026@onelab2.iet.unipi.it>
In-Reply-To: <4EEBBD5E.50603@FreeBSD.org>
References:  <1350C7A0-BE58-4C34-804A-A6A3C1C61761@lpthe.jussieu.fr> <4EEBBD5E.50603@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Dec 16, 2011 at 01:51:26PM -0800, Doug Barton wrote:
> On 12/16/2011 13:40, Michel Talon wrote:
> > Adrian Chadd said:
> > 
> > 
> >> Hi all,
> >> 
> >> Can someone load a kernel module dynamically at boot-time?
> >> 
> >> Ie, instead of compiling it in, can 4bsd/ule be loaded as a KLD at 
> >> boot-time, so the user can just change by rebooting?
> >> 
> >> That may be an acceptable solution for now.
> > 
> > As Luigi explained, the problem is not to have code for both
> > schedulers residing in the kernel, the problem is to migrate
> > processes from one scheduler to the other.
> 
> I think dynamically switching schedulers on a running system and loading
> one or the other at boot time are different problems, are they not?

Runtime switching is a superset of loading as a module at boot time.
In both cases you need to implement a generic interface between the
scheduler and the rest of the system. The good thing, compared to
2002, is that now the abstraction exists, it is made by all functions
and variables named sched_*() in sched_4bsd.c and sched_ule.c

I see there is a small number of #ifdef SCHED_ULE in a couple of
files, but probably it can be fixed.

I believe all is needed for dynamic scheduler loading is to create
function pointers for all these names, and initialize them when one
of the scheduler modules is loaded.

After that, runtime switching shouldn't require a lot of work either.
The architecture and implementation i posted earlier (repeated below
for convenience) should work, with just a bit of attention at locking
the scheduler during a switch.

    References:
       http://kerneltrap.org/node/349
       http://info.iet.unipi.it/~luigi/ps_sched.20020719a.diff

It really looks much easier than i thought initially.

cheers
luigi



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