How to use the Noop IO Scheduler
Environment
- Red Hat Enterprise Linux (RHEL) 4
- Red Hat Enterprise Linux (RHEL) 5
- Red Hat Enterprise Linux (RHEL) 6
- Red Hat Enterprise Linux (RHEL) 7
Issue
- How to turn on the noop scheduler for a device?
- What are the tunables for noop scheduler and what do they do?
- How does the logic within the scheduler work in choosing which IO to dispatch next?
Resolution
Enable noop io scheduler
- Per device:
$ echo 'noop' > /sys/block/sda/queue/scheduler $ cat /sys/block/sda/queue/scheduler [noop] anticipatory deadline cfq - All devices (at boot):
- RHEL 4, 5, 6: you can set noop for all devices via adding
elevator=noopto the end of the kernel line in/etc/grub.conffile:title Red Hat Enterprise Linux Server (2.6.9-67.EL) root (hd0,0) kernel /vmlinuz-2.6.9-67.EL ro root=/dev/vg0/lv0 elevator=noop initrd /initrd-2.6.9-67.EL.img - RHEL 7: you can set noop for all devices via editting
/etc/default/grubas show below and then rebuilding the grub2 configuration file:
[root@host ~]# cat /etc/default/grub GRUB_TIMEOUT=5 GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)" GRUB_DEFAULT=saved GRUB_DISABLE_SUBMENU=true GRUB_TERMINAL_OUTPUT="console" GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=rhel00/root rd.lvm.lv=rhel00/swap elevator=noop" GRUB_DISABLE_RECOVERY="true" - Rebuild the
/boot/grub2/grub.cfgfile by running the grub2-mkconfig command as follows: - On BIOS-based machines:
[root@host ~]# grub2-mkconfig -o /boot/grub2/grub.cfg Generating grub configuration file ... Found linux image: /boot/vmlinuz-3.10.0-327.el7.x86_64 Found initrd image: /boot/initramfs-3.10.0-327.el7.x86_64.img Found linux image: /boot/vmlinuz-0-rescue-537dacc8159a4d4caaa419342da0b820 Found initrd image: /boot/initramfs-0-rescue-537dacc8159a4d4caaa419342da0b820.img done - On UEFI-based machines:
[root@host ~]# grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfg Generating grub configuration file ... Found linux image: /boot/vmlinuz-3.10.0-327.el7.x86_64 Found initrd image: /boot/initramfs-3.10.0-327.el7.x86_64.img Found linux image: /boot/vmlinuz-0-rescue-537dacc8159a4d4caaa419342da0b820 Found initrd image: /boot/initramfs-0-rescue-537dacc8159a4d4caaa419342da0b820.img done
- RHEL 4, 5, 6: you can set noop for all devices via adding
noop tunables
$ ls /sys/block/sda/queue/iosched $
That's right, the directory of tunables is empty - there are no tunables for noop.
See Understanding the Noop IO Scheduler for further information.
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
5 Comments
On UEFI- based machines, one must execute
grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfginstead ofgrub2-mkconfig -o /boot/grub2/grub.cfg.For more info, see: Customizing the GRUB 2 Configuration File.
Is this persistent across kernel updates? Or will we, say after upgrade to newer kernel release, perform this change again? If so, wouldn't a udev rule based setting be more efficient ?
grubby --update-kernel=ALL --remove-args="rhgb quiet" --args="elevator=noop" works carries over to new kernels as well. It modifies /boot/grub2/grub.cfg
My question is why does it not change /etc/default/grub or am I doing something wrong?
I'm thinking this doesn't update the /etc/default/grub file because that's exactly that... the DEFAULT settings. grubby updates the live grub.cfg file directly, so you don't lose any previous edits that may have already been made with grubby
Just wondering why the "grubby" solution to edit grub.cfg directly isn't shown here also? the grub2-mkconfig command rebuilds grub.cfg based on the /etc/default/grub file, which potentially may not have been updated with other changes made to the live grub file.