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

相关推荐
躺着听Jay3 分钟前
【1267 - Illegal mix of collations 】mysql报错解决记录
java·linux·前端
不秃头的帅哥9 分钟前
程序地址空间(基于c++和linxu的一些个人笔记
linux·开发语言·c++·操作系统·内存空间
Yweir10 分钟前
Linux性能监控的工具集和分析命令工具
java·linux·jvm
Tandy12356_11 分钟前
手写TCP/IP协议栈——无回报ARP包生成
c语言·c++·tcp/ip·计算机网络
ZKNOW甄知科技19 分钟前
AI-ITSM的时代正在到来:深度解读Gartner最新报告
大数据·运维·人工智能·低代码·网络安全·微服务·重构
XH-hui20 分钟前
【打靶日记】群内靶机Monkey
linux·网络安全
赖small强20 分钟前
【Linux C/C++开发】C语言函数深度技术指南 (Deep Dive into C Functions)
linux·c语言·函数指针·stack frame
XH-hui24 分钟前
【打靶日记】群内靶机Alluser
linux·网络安全
4t4run41 分钟前
21、Linux常用命令-进程内存CPU相关命令
linux·运维·服务器
weixin_3077791343 分钟前
Jenkins Ioncions API 插件:现代化图标库在持续集成中的应用
java·运维·开发语言·前端·jenkins