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

相关推荐
fiveym4 小时前
05 - 黄金镜像与全自动还原
运维·服务器·架构
OsDepK4 小时前
在安卓Termux终端中部署openssh
linux·服务器
动力 continue12 小时前
Linux 基础篇 · 压缩打包与用户管理
linux·服务器·基础命令linux
画中有画13 小时前
软件架构中质量属性(性能、安全、可扩展性)的权衡设计
java·运维·安全
g3voip13 小时前
防爆电话如何接入SIP调度系统?工业通信系统架构解析
服务器·tcp/ip·系统架构·信息与通信·ip
NJCloud13 小时前
Ansible(三)——Zabbix 监控系统部署与敏感信息加密
linux·运维·chrome·信息可视化·ansible·zabbix
ltl14 小时前
Cgroups v2:为什么内存限制设了,宿主机数据库还是被 OOM
linux
NJCloud14 小时前
TiDB 集群部署与 MySQL 兼容性适配实战
linux·运维·数据库·mysql·tidb
2401_8685347814 小时前
UNIX常用命令英文全称与中文解释整理
linux·运维
阿祖zu15 小时前
开源项目-让本地 Codex 临时接管远程 Linux 服务,实现快速运维
linux·gpt·agent