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

相关推荐
工作10年+,存储芯片行业3 小时前
Linux NVMe 中断排查与性能优化:IRQ 优化(原理+排查)
linux·运维·性能优化·ssd·nvme·pcie·中断
宵时待雨4 小时前
linux笔记归纳25:多路转接epoll
linux·服务器·网络·c++
geats人山人海4 小时前
linux 1.目录结构
linux·运维·服务器
wuminyu4 小时前
JEP491中synchronized关键字引发的平台线程钉住解决方法简介
java·linux·c语言·jvm·c++
应用市场4 小时前
嵌入式Linux从裸板到产品(一):全景地图与交叉编译环境,从四个上板翻车现场说
linux·运维·服务器
CIMPro孪大师5 小时前
CIMPro×DPE | 不止是爆炸动画,AI原生数字样机如何让设备培训与运维更高效
运维·ai-native
皓月盈江5 小时前
Linux系统PC与Linux系统服务器通过scp上传与下载文件
linux·运维·服务器·scp·文件上传·文件下载
对讲机数码科普5 小时前
危化厂区防爆专网通信建设实践:从合规框架到验收清单
运维·网络·架构
Ruiery5 小时前
Linux 6.6内核 CPU 启动深度解析(二):AP 拉起 — BSP 如何用 INIT-SIPI 唤醒其余 CPU
linux·运维·服务器
Lsetea5 小时前
OpenSSL verify报error 62:证书主机名不匹配与-verify_hostname排查
运维·https·ssl证书·openssl·san