summaryrefslogtreecommitdiffstats
path: root/Documentation/kmod.txt
blob: 3deeeaed878c68f19f54dd024ea635eaa9b5a15c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
Kmod: The Kernel Module Loader
Kirk Petersen

Kmod is a simple replacement for kerneld.  It consists of a 
request_module() replacement and a kernel thread called kmod.  When the
kernel requests a module, the kmod wakes up and execve()s modprobe,
passing it the name that was requested.  After a configurable period of
time, kmod will have delete_module() remove any unused modules.

Kmod is configurable through two entries in /proc/sys/kernel.  You can
set the path of modprobe (where the kernel looks for it) by doing:

	echo "/sbin/modprobe" > /proc/sys/kernel/modprobe

To tell kmod when to unload unused modules, do something like:

	echo "120" > /proc/sys/kernel/kmod_unload_delay

Kmod only loads and unloads modules.  Kerneld could do more (although
nothing in the standard kernel used its other features).  If you
require features such as request_route, we suggest that you take
a similar approach.  A simple request_route function could be called,
and a kroute kernel thread could be sent off to do the work.  But
we should probably keep this to a minimum.

Kerneld also had a mechanism for storing device driver settings.  This
can easily be done with modprobe.  When a module is unloaded, modprobe
could look at a per-driver-configurable location (/proc/sys/drivers/blah)
for device driver settings and save them to a file.  When a module
is loaded, simply cat that file back to that location in the proc
filesystem.  Or perhaps a script could be a setting in /etc/modules.conf.
There are many user-land methods that will work (I prefer using /proc,
myself).

If kerneld worked, why replace it?

- kerneld used sysv ipc, which can now be made into a module.  Besides,
  sysv ipc is ugly and should therefore be avoided (well, certainly for
  kernel level stuff)

- both kmod and kerneld end up doing the same thing (calling modprobe),
  so why not skip the middle man?

- removing kerneld related stuff from ipc/msg.c made it 40% smaller

- kmod reports errors through the normal kernel mechanisms, which avoids
  the chicken and egg problem of kerneld and modular unix domain sockets