我有一个令人困惑的问题。我有一个使用sg执行自定义 CDB的库。有几个系统通常会在sg 中出现内存分配问题。通常,sg驱动程序有大约 4mb 的硬限制,但我们在这些具有 ~2.3mb 请求的少数系统上看到它。也就是说,CDB 正准备分配 2.3mb 的传输。这里不应该有任何问题:2.3 < 4.0。
现在,机器的配置文件。它是一个 64 位 CPU,但运行 CentOS 6.0 32 位(我没有构建它们,也与这个决定没有任何关系)。这个 CentOS 发行版的内核版本是 2.6.32。他们有 16GB 的内存。
以下是系统上的内存使用情况(不过,因为此错误发生在自动化测试期间,我尚未验证这是否反映了从sg返回此 errno 时的状态)。
top - 00:54:46 up 5 days, 22:05, 1 user, load average: 0.00, 0.01, 0.21
Tasks: 297 total, 1 running, 296 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.0%us, 0.0%sy, 0.0%ni,100.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 15888480k total, 9460408k used, 6428072k free, 258280k buffers
Swap: 4194296k …Run Code Online (Sandbox Code Playgroud) 这篇 LWN 文章建议人们可以为mq “虚拟调度程序”“下方”的队列添加/替换网络调度程序。这两点都指向这个目的:
The mq scheduler does two things:
- present device TX queues as classes, allowing to attach
different qdiscs to them, which are grafted to the TX queues
- present accumulated statistics of all device queue root qdiscs
Run Code Online (Sandbox Code Playgroud)
我很乐意接受关于如何做到这一点的教育。我尝试过很多组合。例如,从以下默认列表(CentOS 7.6)中:
# tc qdisc show dev eth2
qdisc mq 0: root
qdisc pfifo_fast 0: parent :8 bands 3 priomap 1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
qdisc …Run Code Online (Sandbox Code Playgroud)