I've been wondering for last few days how exactly does it work. We can set kernel runtimes parameters using sysctl or echo boolen 1> /proc/sys/module/exactParameter
but in /sys/modules/module/parameters/parameter
we can also set values.
Are parameters for modules in /proc/sys/
related only to hard complied into kernel? or there could be parameters for Loadable Kernel Modules also?
LKM after being loaded into running Kernel reveal their parameters in /sys/modules/module/paraeter/params
. Does it mean, that there aren't parameters for modules compiled into Kernel?
What is difference between both directories.
Best Answer
There is little relation between
/proc/sys
and/sys
other than the fact that both are kernel interfaces and a coincidence of names./proc/sys
is an interface to sysctl, which are kernel configuration parameters. Reading or modifying/proc/sys/foo/bar
is equivalent to getting or setting thefoo.bar
sysctl. Sysctl values are organized by semantic categories, they are not intrinsically related to the structure of the kernel. Many sysctl values are settings that are present on every Linux system regardless of what drivers or features are compiled in; some are related to optional features (e.g. certain network protocols) but never to specific hardware devices./sys/module
is, as the name indicates, an interface to kernel modules. Each directory corresponds to one kernel module. You can read, and sometimes modify, the parameters of the modulefoo
by writing to/sys/module/foo/parameters/*
.Components that are loaded in the kernel read their parameters from the kernel command line. These parameters cannot be set at runtime (at least not through an automatically-generated interface like
/sys/module
: the component can expose a custom interface for this).