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不让申请内存。

相关推荐
haimin03716 分钟前
ubuntu 20.04 安装xrdp远程桌面访问
linux·运维·ubuntu
liu****24 分钟前
4.基础开发工具(一)
linux·开发语言·1024程序员节
乌托邦的逃亡者36 分钟前
Linux系统中配置history命令显示时间、IP、账号和操作命令
linux·运维·安全
趙小贞40 分钟前
字符设备驱动开发流程与实战:以 LED 驱动为例
linux·c语言·驱动开发
Archy_Wang_11 小时前
Elasticsearch8.4.1升级Elasticsearch9.1.5
运维·elasticsearch·jenkins
集智飞行1 小时前
docker login方法
运维·docker·容器
Wang's Blog2 小时前
Linux小课堂: Vim与Emacs之Linux文本编辑器的双雄格局及Vim安装启动详解
linux·vim·emacs
观山岳五楼2 小时前
unbuntu系统配置IPV6的三种模式
linux·服务器·ip·1024程序员节
运维行者_3 小时前
AWS云服务故障复盘——从故障中汲取的 IT 运维经验
大数据·linux·运维·服务器·人工智能·云计算·aws
王道长服务器 | 亚马逊云3 小时前
AWS Systems Manager:批量服务器管理的隐藏利器
linux·网络·云计算·智能路由器·aws