Linux: network: tcp:__sk_mem_raise_allocated;确保公平

之前看这个函数里有一个地方没有看懂,代码如下:

cpp 复制代码
       if (sk_has_memory_pressure(sk)) {
              int alloc;

              if (!sk_under_memory_pressure(sk))
                     return 1;
              alloc = sk_sockets_allocated_read_positive(sk);  
              if (sk_prot_mem_limits(sk, 2) > alloc *
                  sk_mem_pages(sk->sk_wmem_queued +
                            atomic_read(&sk->sk_rmem_alloc) +
                            sk->sk_forward_alloc))
                     return 1;
       }

今天在网上找了一下,搜到下面的链接,里面有一个解释是:

https://lore.kernel.org/all/20231019120026.42215-2-wuyun.abel@bytedance.com/

Try to be fair among all the sockets under global pressure by allowing the ones that below average usage to raise.

尝试在全局压力下的所有套接字之间保持一个公平,允许低于平均使用率的套接字升高,高使用内存的socket不让申请内存。

相关推荐
沫璃染墨1 天前
从零入门计算机网络系列(十二):HTTP长连接与会话管理详解——从Connection到Cookie与Session
linux·服务器·c++·tcp/ip·ubuntu·http·交互
温暖小土1 天前
在 CentOS 上安装 Redis Stack
linux·redis·centos
GeW1 天前
国产化替代进入深水区之后Linux 与数据库为什么必须走向重建
linux
万联WANFLOW1 天前
异地厂区视频监控远程运维:从组网到安全的实施要点
运维·网络·安全·企业组网·sdwan
衍玊1 天前
深入剖析 TCP/IP 网络通信原理与内核实现
服务器·网络·tcp/ip
十碗饭吃不饱1 天前
SSH 密钥认证详解:原理、实操、参数、排错与加固
运维·ssh
echoarts1 天前
服务器连不上?FileZilla 改被动模式就好了
运维·服务器·其他
无言听风雨丶1 天前
Redis 运维实战与排错
运维·数据库·redis
QXWZ_IA1 天前
变电站数字孪生巡检的能力分层、数据接入与空间计算边界
运维·服务器·空间计算
FPGA小迷弟1 天前
FPGA 与千兆以太网:各类物理接口的形式、区别、使用方法与应用场景详解
tcp/ip·macos·fpga开发·udp·fpga