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

相关推荐
小政同学4 小时前
【NFS故障】共享的文件无法执行
linux·运维·服务器
AI木马人4 小时前
3.【Prompt工程实战】如何设计一个可复用的Prompt系统?(避免每次手写提示词)
linux·服务器·人工智能·深度学习·prompt
ch3nyuyu4 小时前
Ubuntu(乌班图)基础指令
linux·运维·网络
minglie15 小时前
gcc编译器汇总
linux
挽安学长5 小时前
保姆级教程,通过GACCode使用Claude Code Desktop!
运维·服务器
firstacui6 小时前
MGRE实验
运维·服务器·网络
白菜欣6 小时前
Linux —《开发三件套:gcc/g++、gdb、make/Makefile 全解析》
linux·运维
何中应6 小时前
Grafana如何给列表设置别名
运维·grafana·监控
senijusene7 小时前
基于 imx6ull平台按键驱动开发:input子系统+中断子系统+platform总线
linux·驱动开发
MXsoft6187 小时前
运维的尽头,是把“救火”变成“算命”
运维