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

相关推荐
qq_1631357533 分钟前
Linux 【03- chgrp命令超详细教程】
linux
考虑考虑1 小时前
nginx配置ssl
运维·后端·nginx
我会尽全力 乐观而坚强2 小时前
MySQL库与表的操作
linux·数据库·mysql
着迷不白2 小时前
Linux 磁盘管理完全指南:分区、文件系统、挂载与 LVM 实战
linux·运维·服务器
山川而川-R2 小时前
LangChain
linux·运维·服务器
QH_ShareHub2 小时前
Linux 根目录结构详解
linux·运维·服务器
liulilittle2 小时前
KCC 边界缺陷深度分析:六问题根源与解决方案
网络·网络协议·tcp/ip·计算机网络·信息与通信·ip·通信
SkyWalking中文站3 小时前
认识 Horizon UI · 17/17:安装与迁移
运维·监控·自动化运维
SkyWalking中文站3 小时前
认识 Horizon UI · 16/17:八种语言的本地化
运维·监控·自动化运维
郝学胜-神的一滴3 小时前
CMake 038:OBJECT目标复用编译+Linux动态库版本自动化管理
linux·c++·程序人生·软件工程·软件构建·cmake·工程配置