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

相关推荐
木童66218 分钟前
nginx安装步骤详解
linux·运维·服务器·网络·nginx
暴躁的菜鸡1 小时前
Ubuntu安装向日葵
linux·运维·ubuntu
wa的一声哭了1 小时前
Webase部署Webase-Web在合约IDE页面一直转圈
linux·运维·服务器·前端·python·区块链·ssh
Aufidius1 小时前
虚拟机ubuntu存储空间不够如何扩容(扩充根目录)
linux·运维·ubuntu
Warren982 小时前
软件测试常见面试题
linux·python·django·flask·virtualenv·pygame·tornado
tan180°2 小时前
Linux网络IP(上)(15)
linux·网络·tcp/ip
云和数据.ChenGuang3 小时前
运维工程师技术教程之nginx ip访问机制
运维·tcp/ip·nginx
没有名字的鬼3 小时前
RK3399 SSH连接设置
linux·ssh·rk3399·mobaxterm
“αβ”3 小时前
MySQL库的操作
linux·服务器·网络·数据库·c++·mysql·oracle
lhyzws3 小时前
CENTOS上的网络安全工具(二十八)SPARK+NetSA Security Tools容器化部署(4)
linux·spark·centos