I was reading about how TCP congestion variants are implemented in Linux. Each variant is implemented as a separate module.

When I had read this question: Add TCP congestion control variant to Linux Ubuntu

I understood that the variant can be loaded using modprobe.

Does that mean when lsmod is running, TCP cubic must show as default-loaded? When I run lsmod, I cannot find the loaded module associated with congestion control. Are there specific types of kernel modules are listed under lsmod?


There's the question to address and a little clarification for this specific case (congestion).

A kernel module is a part of the kernel that is optional and doesn't have to be present at kernel initial start nor later if not needed. It's a kind of plug-in. This allows to have most functionalities available on-demand, without using memory if never used. Most modules can be compiled as modules or built-in. If built-in, it implies you won't find a .ko module file because it's already in the initial kernel.

You can check what was done:

  • either by knowing the configuration option (here CONFIG_TCP_CONG_CUBIC), having access to the configuration used, usually as a file in /boot/config-$(uname -r), and verifying what option was used:

    grep CONFIG_TCP_CONG_CUBIC /boot/config-$(uname -r)
  • or by knowing the module name and checking if the module is in the list of built-in modules:

    fgrep tcp_cubic.ko /lib/modules/$(uname -r)/modules.builtin

Examples of likely results for your case since you didn't find the module, but with cubic the likely default it probably means it was built-in:

$ grep _CUBIC /boot/config-$(uname -r)
$ fgrep tcp_cubic.ko /lib/modules/$(uname -r)/modules.builtin

So this answers the question: consider you have the module always loaded, because it's built-in. It makes sense to have the default be built-in (it's often required).

The list of built-in module files you might expect to find somewhere in /lib/modules/$(uname -r) and be displayed with lsmod but that you won't, can be displayed with cat /lib/modules/$(uname -r)/modules.builtin. They are not special, but were chosen so (by your Linux distribution) often but not always because a default had to be chosen among a list of choices, to be built-in, including all related module dependencies.

Now about the little clarification: of course a module has to be loaded (or built-in) to have its functionality available. But the Q/A you linked to didn't say you only had to load the tcp congestion module to have it activated. Quote:

To try one of these you need to install it using modprobe -a tcp_westwood or whatever you want. You can then test it using this

echo "westwood" > /proc/sys/net/ipv4/tcp_congestion_control

Since this pseudo-file is read/write, you can just query it to know what congestion is in use with probably this result:

$ cat /proc/sys/net/ipv4/tcp_congestion_control

Now to change the algorithm:

# lsmod | grep tcp_westwood
# echo westwood > /proc/sys/net/ipv4/tcp_congestion_control
# lsmod | grep tcp_westwood
tcp_westwood           16384  1

The module was auto-loaded and is now in use (some systems might not auto-load).

Anyway the adequate information for this specific case is in /proc/sys/net/ipv4/tcp_congestion_control, not lsmod's output.

| improve this answer | |
  • Thanks for the clarification. It makes more sense now. Also, does that mean multiple tcp variants can me simultaneously loaded, but the one used will be based on the tcp_congestion_control file? – Gautam Ramakrishnan Sep 16 '18 at 13:15
  • Yes. Now I don't know if there are options to use multiple ones at once (probably doesn't make much sense), but I can tell it's a per socket use: I now temporarily have sockets using cubic and others using westwood (until they close). – A.B Sep 16 '18 at 13:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.