LX: Add missing procfs tunable
Sometimes applications require the following tunables to be present:
- /proc/sys/net/core/rmem_default
- /proc/sys/net/core/wmem_default
- /proc/sys/net/core/rmem_max
- /proc/sys/net/core/wmem_max
- /proc/sys/kernel/panic_on_oops
Testing:
root@ca47b8b6-5bde-466a-b5ff-6ddb472d15b2:~# cat /proc/sys/net/core/rmem_default
1048576
root@ca47b8b6-5bde-466a-b5ff-6ddb472d15b2:~# /native/usr/sbin/ipadm show-prop -p recv_buf tcp
PROTO PROPERTY PERM CURRENT PERSISTENT DEFAULT POSSIBLE
tcp recv_buf rw 1048576 -- 1048576 2048-6291456
root@ca47b8b6-5bde-466a-b5ff-6ddb472d15b2:~# cat /proc/sys/net/core/wmem_default
128000
root@ca47b8b6-5bde-466a-b5ff-6ddb472d15b2:~# /native/usr/sbin/ipadm show-prop -p send_buf tcp
PROTO PROPERTY PERM CURRENT PERSISTENT DEFAULT POSSIBLE
tcp send_buf rw 128000 -- 128000 4096-6291456
root@ca47b8b6-5bde-466a-b5ff-6ddb472d15b2:~# cat /proc/sys/net/core/rmem_max
6291456
root@ca47b8b6-5bde-466a-b5ff-6ddb472d15b2:~# cat /proc/sys/net/core/wmem_max
6291456
root@ca47b8b6-5bde-466a-b5ff-6ddb472d15b2:~# /native/usr/sbin/ipadm show-prop -p max_buf tcp
PROTO PROPERTY PERM CURRENT PERSISTENT DEFAULT POSSIBLE
tcp max_buf rw 6291456 -- 1048576 8192-1073741824
root@ca47b8b6-5bde-466a-b5ff-6ddb472d15b2:~# echo "1048577" > /proc/sys/net/core/rmem_default
root@ca47b8b6-5bde-466a-b5ff-6ddb472d15b2:~# cat /proc/sys/net/core/rmem_default
1048577
root@ca47b8b6-5bde-466a-b5ff-6ddb472d15b2:~# /native/usr/sbin/ipadm show-prop -p recv_buf tcp
PROTO PROPERTY PERM CURRENT PERSISTENT DEFAULT POSSIBLE
tcp recv_buf rw 1048577 -- 1048576 2048-6291456
root@ca47b8b6-5bde-466a-b5ff-6ddb472d15b2:~# echo "128001" > /proc/sys/net/core/wmem_default
root@ca47b8b6-5bde-466a-b5ff-6ddb472d15b2:~# /native/usr/sbin/ipadm show-prop -p send_buf tcp
PROTO PROPERTY PERM CURRENT PERSISTENT DEFAULT POSSIBLE
tcp send_buf rw 128001 -- 128000 4096-6291456
root@ca47b8b6-5bde-466a-b5ff-6ddb472d15b2:~# echo "6291457" > /proc/sys/net/core/wmem_max
root@ca47b8b6-5bde-466a-b5ff-6ddb472d15b2:~# /native/usr/sbin/ipadm show-prop -p max_buf tcp
PROTO PROPERTY PERM CURRENT PERSISTENT DEFAULT POSSIBLE
tcp max_buf rw 6291457 -- 1048576 8192-1073741824
root@ca47b8b6-5bde-466a-b5ff-6ddb472d15b2:~# cat /proc/sys/net/core/wmem_max
6291457
root@ca47b8b6-5bde-466a-b5ff-6ddb472d15b2:~# cat /proc/sys/net/core/rmem_max
6291457
root@ca47b8b6-5bde-466a-b5ff-6ddb472d15b2:~# cat /proc/sys/kernel/panic_on_oops
1
Interesting.
On Linux, do writing to those affect not-only TCP, but ALSO UDP, SCTP, and even AF_UNIX sockets? If so, we'll need to make a design decision. I'll need some documentation of these (Linux doc web pointers ?), as well as an overview. I see you have semantics in the code comments; I'd like them on the eventual OS- ticket I'll file.
Interesting.
On Linux, do writing to those affect not-only TCP, but ALSO UDP, SCTP, and even AF_UNIX sockets? If so, we'll need to make a design decision. I'll need some documentation of these (Linux doc web pointers ?), as well as an overview. I see you have semantics in the code comments; I'd like them on the eventual OS- ticket I'll file.
According to the documentation at https://www.kernel.org/doc/html/latest/admin-guide/sysctl/net.html one could assume that this could affect all protocols, and this is clarified by looking at tcp_rmem https://www.kernel.org/doc/html/latest/networking/ip-sysctl.html
tcp_rmem - vector of 3 INTEGERs: min, default, max min: Minimal size of receive buffer used by TCP sockets. It is guaranteed to each TCP socket, even under moderate memory pressure.
Default: 4K
default: initial size of receive buffer used by TCP sockets. This value overrides net.core.rmem_default >used by other protocols. Default: 131072 bytes. This value results in initial window of 65535.
max: maximal size of receive buffer allowed for automatically selected receiver buffers for TCP socket. >This value does not override net.core.rmem_max. Calling setsockopt() with SO_RCVBUF disables automatic tuning of that socket’s receive buffer size, in which case this value is ignored. Default: between 131072 and 6MB, depending on RAM size.
As I understood this implies that /proc/sys/net/core/<wmem|rmem>_<default|max> settings affects the rest of the protocols, but a quick test on a Linux VM I see no change in tcp_rmem when updating /proc/sys/net/core/rmem_default nor rmem_max.
Also changing /proc/sys/net/ipv4/tcp_rmem does not overrides /proc/sys/net/core/rmem_default, so it seems the documentation on this is incorrect, as someone else found before https://bugzilla.kernel.org/show_bug.cgi?id=209327
On the wild there guides that use those parameters to improve performance https://cromwell-intl.com/open-source/performance-tuning/tcp.html
Here, we are only modifying the TCP side of things. On the plus side, scripts that check these sysctls will continue to function without failing. However, achieving full compatibility would require further research on the Linux side. As it stands, the current approach is useful in just that sense.
Should we just make this PR OS-8682's official one?
Should we just make this PR OS-8682's official one?
I just created a new branch to make it official https://github.com/TritonDataCenter/illumos-joyent/pull/517. git pbchk is clean.
Should we just make this PR OS-8682's official one?
I just created a new branch to make it official #517. git pbchk is clean.
Should this one get closed?