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

相关推荐
IPdodo_23 分钟前
2026年爬虫代理 IP 选择指南:从可用率、延迟到成本验收
网络协议·tcp/ip·scrapy·http·https·beautifulsoup·httpx
zx_7414848133 分钟前
【Linux入门】Linux 安装:VMware Workstation Pro 安装 CentOS 7 保姆级图文教程
linux·centos
myy-learn1 小时前
31-TCP并发
服务器·网络·tcp/ip
名字还没想好☜1 小时前
Docker buildx 多架构镜像实战:一次构建 amd64+arm64,告别 exec format error
运维·docker·eureka·架构·kubernetes
智购科技无人售货机厂家1 小时前
2026自动售货机备用电池管理系统设计:从充放电保护到健康监测的工程实践~YH
大数据·linux·单片机·嵌入式硬件·微信
小雪崩1 小时前
嵌入式学习 day39:TCP并发服务器模型
linux·服务器·c语言·网络·学习·tcp/ip
智购无人售货机厂家1 小时前
2026自动售货机软硬件版本管理策略:从版本号规范到兼容性矩阵的工程实践~YH
运维·服务器·人工智能·单片机·嵌入式硬件·线性代数·矩阵
spencer_tseng2 小时前
[j2cache ehcache.xml]/tmp/.ehcache-diskstore.lock (Permission denied)
xml·linux·python·ehcache·[j2cache
内核笔记2 小时前
休眠唤醒 standby 调试
linux·bsp
小白不想画工图2 小时前
银河麒麟V10系统安装QT5.12
linux·开发语言·qt·银河麒麟