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

相关推荐
取经蜗牛2 小时前
Ubuntu 国内镜像源配置指南(多版本常用镜像地址都有)
linux·运维·ubuntu
实心儿儿3 小时前
Linux —— 线程控制(1)
linux·运维·服务器
筠筠喵呜喵3 小时前
Linux软件开发性能优化
linux·c++·性能优化
Bruce_kaizy4 小时前
c++ linux环境编程——文件io介绍以及open 、write 、read 三剑客深度详解
linux·服务器·c++·ubuntu·操作系统·文件io
亦良Cool4 小时前
VMware虚拟机ubuntu瘦身,解决虚拟机越用越大
linux·运维·ubuntu
星辰&与海5 小时前
KVM + QEMU虚拟化方案
linux·运维
宋浮檀s6 小时前
应急响应——恶意流量&攻击行为识别
linux·运维·网络·网络安全·应急响应
REDcker6 小时前
Linux OverlayFS详解
java·linux·运维
zizle_lin6 小时前
WSL的系统安装和部分环境配置(按需操作)
运维
lwx9148526 小时前
Linux系统中用户锁定后如何解锁
linux·运维·服务器