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

相关推荐
YongCheng_Liang6 分钟前
MySQL 高级特性深度解析:从索引优化到高可用架构
运维·数据库·mysql
RisunJan35 分钟前
Linux命令-jwhois(查询域名和IP地址注册信息)
linux·tcp/ip
Run_Teenage1 小时前
认识ELF格式文件,理解库链接过程
linux·运维·服务器
Leon-zy1 小时前
【Linux】Linux下手动添加的systemctl服务使用journalctl查看无日志或排版乱
linux·运维·服务器
软件工程小施同学1 小时前
区块链论文速读 CCF A--TDSC 2025 (3)
运维·服务器·区块链
是娇娇公主~1 小时前
TCP和UDP的区别全面对比讲解
网络·tcp/ip·udp
欧洵.1 小时前
深入理解TCP协议
java·网络·tcp/ip
Q16849645151 小时前
红帽Linux-监控和管理Linux进程
linux·运维·服务器
maosheng11461 小时前
HCIP的OSPF进阶综合实验
linux·运维·服务器
开开心心就好1 小时前
内存清理工具开源免费,自动优化清理项
linux·运维·服务器·python·django·pdf·1024程序员节