Linux CFQ、Deadline 和 NOOP 之间有什么区别?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9338378/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-06 04:38:58  来源:igfitidea点击:

What is the difference between CFQ, Deadline, and NOOP?

linuxiolinux-kernelkernelrecompile

提问by Orcris

I'm recompiling my kernel, and I want to choose an I/O scheduler. What's the difference between these?

我正在重新编译我的内核,我想选择一个 I/O 调度程序。这些有什么区别?

回答by sarnold

If you compile them all, you can select at boot time or per-device which scheduler to use. No need to pick at compile time, unless you are targeting an embedded device where every byte counts. See Documentation/block/switching-sched.txtfor details on switching per-device or system-wide at boot.

如果将它们全部编译,则可以在启动时或按设备选择要使用的调度程序。无需在编译时进行选择,除非您的目标是每个字节都很重要的嵌入式设备。有关Documentation/block/switching-sched.txt在启动时切换每个设备或系统范围的详细信息,请参阅。

The CFQ scheduler allows you to set priorities via the ionice(1)tool or the ioprio_set(2)system call. This allows giving precedence to some processes or forcing others to do their IO only when the system's block devices are relatively idle. The queues are implemented by segregating the IO requests from processes into queues, and handling the requests from each queue similar to CPU scheduling. Details on configuring it can be found in Documentation/block/cfq-iosched.txt.

CFQ 调度程序允许您通过ionice(1)工具或ioprio_set(2)系统调用设置优先级。这允许仅在系统的块设备相对空闲时才给予某些进程优先权或强制其他进程执行其 IO。队列是通过将来自进程的 IO 请求隔离到队列中来实现的,并像 CPU 调度一样处理来自每个队列的请求。可以在 中找到有关配置它的详细信息Documentation/block/cfq-iosched.txt

The deadline scheduler by contrast looks at all writes from all processes at once; it sorts the writes by sector number, and writes them all in linear fashion. The deadlines means that it tries to write each block before its deadline expires, but within those deadlines, is free to re-arrange blocks as it sees fit. Details on configuring it can be found in Documentation/block/deadline-iosched.txt.

相比之下,deadline 调度器一次查看所有进程的所有写入;它按扇区号对写入进行排序,并以线性方式将它们全部写入。截止日期意味着它尝试在截止日期到期之前写入每个块,但在这些截止日期内,可以自由地根据需要重新排列块。可以在 中找到有关配置它的详细信息Documentation/block/deadline-iosched.txt

回答by MarkR

Probably very little in practice.

在实践中可能很少。

In my testing, I found that in general NOOP is a bit better if you have a clever RAID controller. Others have reported similar results, but your workload may be different.

在我的测试中,我发现如果你有一个聪明的 RAID 控制器,一般来说 NOOP 会更好一些。其他人报告了类似的结果,但您的工作量可能有所不同。

However, you can select them at runtime (without reboot) so don't worry about it at compile-time.

但是,您可以在运行时选择它们(无需重新启动),因此在编译时不必担心。

My understanding was that the "clever" schedulers (CFQ and deadline) are only really helpful on traditional "spinning disc" devices which don't have a RAID controller.

我的理解是“聪明的”调度程序(CFQ 和截止日期)仅对没有 RAID 控制器的传统“旋转磁盘”设备真正有用。