Marcus Folkesson

Embedded Linux Artist

High resolution timers

High resolution timers Nearly all systems has some kind of Programmable Interrupt Timer (PIT) or High Precision Event Timer (HPET) that is programmed to periodically interrupt the operating system (if not configured with CONFIG_NO_HZ). The kernel performs several tasks in these ticks such as timekeeping, calculate statistics for the currently running process, schedule a new process and so on. The interrupt occurs at regular intervals - exactly HZ times per second.

Modules with parameters

Modules with parameters Everybody knows that modules can take parameters, either via /sys/modules/<module>/parameters, sysctl or via cmdline to the kernel, but how are these parameters created? Parameters without callbacks The Linux kernel provides the module_param() macro. The syntax is: 1module_param(name, type, perm) Which will simply create the module parameter and expose it as an entry in /sys/modules/<module>/parameters. Code example 1int debug_flag; 2module_param(debug_flag, bool, S_IRUSR | S_IWUSR | S_IRGRP) 3MODULE_PARM_DESC(debug_flag, "Set to 1 if debug should be enabled, 0 otherwise"); MODULE_PARM_DESC() is a short description of the parameter.