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

相关推荐
YMWM_1 小时前
linux文件快速传windows
linux·运维·服务器
星竹晨L1 小时前
Linux开发工具入门(一):开发三板斧(包管理器,vim,gcc/g++) 以及入门理解动静态库
linux·运维·服务器
sunxunyong8 小时前
CGroup配置
linux·运维·服务器
hy____1238 小时前
Linux_网络编程套接字
linux·运维·网络
IP搭子来一个9 小时前
爬虫IP地址受限怎么办?附解决方法
网络·爬虫·tcp/ip
若风的雨9 小时前
【deepseek】 Linux 调度延时分析
linux
小夏卷编程9 小时前
Ubuntu 20.04.4 宝塔 docker showdoc v3.2 更新到v3.7.3
运维·docker·容器
康康的AI博客9 小时前
农业工业变革:如何通过DMXAPI中转提升自动化效率
运维·人工智能·自动化
2301_803554529 小时前
linux 以及 c++编程里对于进程,线程的操作
linux·运维·c++
LuDvei10 小时前
windows 中 vs code远程连接linux
linux·运维·服务器·windows