MODULE DEBUGGING STATISTICS OVERVIEW(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

🌸 NAME 🌸

module debugging statistics overview

okay so bestie, this is the module debug...ics overview(9) page from the Kernel API Manual. it's giving kernel module stats realness, and we're gonna get into it πŸ’…

✨ DESCRIPTION ✨

Enabling CONFIG_MODULE_STATS unlocks module debugging statistics. These are genuinely useful for monitoring and root-causing memory pressure issues with module loading, and they help us improve production workloads. no cap.

The current module debugging statistics supported help keep track of module loading failures, so we can make improvements either for kernel module auto-loading usage (request_module) or interactions with userspace. Statistics are provided to track all possible failures in the finit_module path and memory wasted in this process space. Each of the failure counters is associated with a type of module loading failure that's known to incur a certain amount of memory allocation loss. In the worst case, loading a module will fail after a 3 step memory allocation process:

  • a) memory allocated with kernel_read_file_from_fd
  • b) module decompression processes the file read from kernel_read_file_from_fd, and vmap is used to map the decompressed module to a new local buffer which represents a copy of the decompressed module passed from userspace. The buffer from kernel_read_file_from_fd is freed right away.
  • c) layout_and_allocate allocates space for the final resting place where we would keep the module if it were to be processed successfully.

If a failure occurs after these three different allocations, only one counter will be incremented with the summation of the allocated bytes freed incurred during this failure. Likewise, if module loading failed only after step b), a separate counter is used and incremented for the bytes freed and not used during both of those allocations. periodt.

Virtual memory space can be limited β€” for example, on x86 virtual memory size defaults to 128 MiB. We should strive to limit and avoid wasting virtual memory allocations when possible. These module debugging statistics help to evaluate how much memory is being wasted on bootup due to module loading failures. lowkey important 🫢.

All counters are designed to be incremental. Atomic counters are used so to remain simple and avoid delays and deadlocks. iconic.

πŸ’– SEE ALSO πŸ’–

  • Kernel file ./kernel/module/stats.c dup_failed_modules - tracks duplicate failed modules(9), module statistics debugfs counters(9)

byeee bestie πŸŽ€ β€” source/version: ./kernel/module, date: October 2026, and this was the module debug...ics overview(9) page. catch u later ✨

πŸ“¦ where this page comes from