From owner-freebsd-stable@FreeBSD.ORG Fri Dec 16 22:43:32 2011 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 34EFB1065673; Fri, 16 Dec 2011 22:43:32 +0000 (UTC) (envelope-from luigi@onelab2.iet.unipi.it) Received: from onelab2.iet.unipi.it (onelab2.iet.unipi.it [131.114.59.238]) by mx1.freebsd.org (Postfix) with ESMTP id E82128FC08; Fri, 16 Dec 2011 22:43:31 +0000 (UTC) Received: by onelab2.iet.unipi.it (Postfix, from userid 275) id 206387300A; Fri, 16 Dec 2011 23:59:54 +0100 (CET) Date: Fri, 16 Dec 2011 23:59:54 +0100 From: Luigi Rizzo To: Doug Barton Message-ID: <20111216225954.GA83026@onelab2.iet.unipi.it> References: <1350C7A0-BE58-4C34-804A-A6A3C1C61761@lpthe.jussieu.fr> <4EEBBD5E.50603@FreeBSD.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4EEBBD5E.50603@FreeBSD.org> User-Agent: Mutt/1.4.2.3i Cc: freebsd-stable@freebsd.org, Michel Talon Subject: Re: switching schedulers (Re: SCHED_ULE should not be the default) X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Dec 2011 22:43:32 -0000 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