From: Ingo Molnar <mingo@elte.hu>
To: "T. J. Brumfield" <enderandrew@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: about modularization
Date: Fri, 3 Aug 2007 15:19:00 +0200 [thread overview]
Message-ID: <20070803131900.GA26203@elte.hu> (raw)
In-Reply-To: <cdc89fe60708030507r29283942mbb9947edbe04e23a@mail.gmail.com>
* T. J. Brumfield <enderandrew@gmail.com> wrote:
> 1 - Can someone please explain why the kernel can be modular in every
> other aspect, including offering a choice of IO schedulers, but not
> kernel schedulers?
that's a fundamental misconception. If you boot into a distro kernel on
a typical PC, about half of the kernel code that the box runs in any
moment will be in modules, half of it is in the "kernel core". For
example, on a random laptop:
$ echo `lsmod | cut -c1-30 | cut -d' ' -f2-` | sed 's/Size //' |
sed 's/ /+/g' | bc
2513784
i.e. 2.5 MB of modules. The core kernel's size:
$ dmesg | grep 'kernel code'
Memory: 2053212k/2087808k available (2185k kernel code, 33240k reserved, 1174k data, 244k init, 1170304k highmem)
2.1 MB of kernel core code. (of course the total body of "possible
drivers" is 10 times larger than that of the core kernel - but the
fundamental 'variety' is not.)
most of the modules are for stuff where there is a significant physical
difference between the components they support. Drivers for different
pieces of hardware. Filesystem drivers for different on-disk physical
layouts. Network protocol drivers for different on-wire formats. The
sanest technological decision there is clearly to modularize.
And note that often it's not even about choice there: the user's system
has a particular piece of hardware, to which there is usually one
primary driver. The user does not have any real 'choice' over the
modularization here, it's largely a technological act to make the
kernel's footprint smaller.
But the kernel core, which does not depend as much on the physical
properties of the stuff it supports (it depends on the physics of the
machine of course, but those rules are mostly shared between all
machines of that architecture), and is fundamentally influenced by the
syscall API (which is not modular either) and by our OS design
decisions, has much less reason to be modularized.
The core kernel was always non-modular, and it depends on the technical
details whether we want to or _have to_ modularize something so that it
becomes modular to the user too. For example we dont have 'competing',
modular versions of the IPv4 stack. Neither of the VFS. Nor of timers,
futexes, nor of locking code or of the CPU scheduler. But we can switch
out any of those implementations from the core kernel, and did so
numerous times in the past and will do so in the future.
CPU schedulers are as core kernel code as it gets - you cannot even boot
without having a CPU scheduler. IO schedulers, although similar in name,
are quite different beasts from CPU schedulers, and they are somewhere
between the core kernel and drivers. They are not 'physical drivers' (an
IO scheduler can drive any disk), nor are they fully 'core kernel code'
in the sense of a kernel not even being able to boot without them. Also,
disks are physically different from CPUs, in a way which works _against_
the user-modularization of CPU schedulers. (there are also many other
differences which have been pointed out in the past)
In any case, the IO subsystem maintainers decided to modularize IO
schedulers, and that's their decision. One of the authors of the IO
scheduler code said it on lkml recently that while modularization of IO
scheduler had advantages too, in retrospect he wishes they would not
have made IO schedulers modular and now that decision cannot be undone.
So even that much different situation was far from a clear decision, and
some negative effects can be felt today too, in form of having two
primary IO schedulers but not having one IO scheduler that works well in
all cases. For CPU schedulers the circumstances point away away from
user-selectable modularization even stronger.
Ingo
next prev parent reply other threads:[~2007-08-03 13:19 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-03 12:07 Scheduler Situation T. J. Brumfield
2007-08-03 12:31 ` Alistair John Strachan
2007-08-03 12:52 ` Oleksandr Natalenko
[not found] ` <192840a00708030616g22d9dd16o95b2620bfe3347a8@mail.gmail.com>
2007-08-03 13:27 ` Андрій Мішковський
2007-08-03 13:45 ` Alistair John Strachan
2007-08-03 13:00 ` debian developer
2007-08-03 15:28 ` about modularization Ingo Molnar
2007-08-03 13:19 ` Ingo Molnar [this message]
[not found] ` <cdc89fe60708030651s54b5f0e0j938450632cf621c5@mail.gmail.com>
2007-08-03 13:52 ` Fwd: " T. J. Brumfield
2007-08-03 15:02 ` Ingo Molnar
2007-08-03 15:13 ` Ingo Molnar
2007-08-03 17:47 ` Rene Herman
2007-08-03 18:59 ` Ingo Molnar
2007-09-01 22:02 ` Oleg Verych
[not found] ` <200708031354.15485.alistair@devzero.co.uk>
[not found] ` <cdc89fe60708030712q391de609o3999a870ea7cbcbd@mail.gmail.com>
[not found] ` <200708031540.29687.alistair@devzero.co.uk>
2007-08-03 14:51 ` Scheduler Situation T. J. Brumfield
2007-08-03 15:05 ` Alistair John Strachan
-- strict thread matches above, loose matches on Subject: below --
2007-08-06 20:20 about modularization Mitchell Erblich
2007-08-06 20:50 ` Rene Herman
2007-08-06 21:48 Mitchell Erblich
2007-08-06 23:35 ` Rene Herman
2007-08-06 23:45 ` Rene Herman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070803131900.GA26203@elte.hu \
--to=mingo@elte.hu \
--cc=enderandrew@gmail.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox