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

相关推荐
lwx9148523 小时前
Linux-特殊权限SUID,SGID,SBIT
linux·运维·服务器
皮卡狮4 小时前
Linux权限的概念
linux
炘爚5 小时前
深入解析printf缓冲区与fork进程复制机制
linux·运维·算法
workflower5 小时前
注塑机行业目前自动化现状分析
运维·人工智能·语言模型·自动化·集成测试·软件工程·软件需求
小义_5 小时前
随笔 3(Linux)
linux·运维·服务器·云原生·红帽
#六脉神剑6 小时前
MySQL参数调优:十个关键参数助力数据库性能数倍提升
运维·mysql
cccccc语言我来了6 小时前
Linux(10)进程概念
linux·运维·服务器
伐尘6 小时前
【linux】查看空间(内存、磁盘、文件目录、分区)的几个命令
linux·运维·网络
Deitymoon6 小时前
linux——PV操作
linux
倔强的胖蚂蚁7 小时前
x2openEuler 辅助机完整部署教程
运维·云原生