switching schedulers (Re: SCHED_ULE should not be the default)
rizzo at iet.unipi.it
Fri Dec 16 22:43:32 UTC 2011
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.
It really looks much easier than i thought initially.
More information about the freebsd-stable