Enabling BFQ for NVME

Advertisement

According to phoronix, BFQ’s performance pretty much exceeds expectations. And according to CNX Software, the latest kernels improved BFQ’s performance even further while fixing a bunch of issues.

So let’s try turning this thing on.

Advertisement

photo_2019-08-15_11-52-24.jpg

First, check what scheduler you’re currently using:

cat /sys/block/sda/queue/scheduler

If you’re on an NVMe device like me, you’ll need:

cat /sys/block/nvme0n1/queue/scheduler

You’ll usually see something like:

mq-deadline [none]

So let’s get it enabled.

According to the Ubuntu Wiki, editing the Grub file enables extra scheduler support:

vim /etc/default/grub

Add:

scsi_mod.use_blk_mq=1

Then update your Grub:

sudo update-grub

After that, edit the rules:

vim /etc/udev/rules.d/60-schedulers.rules

Add:

# set deadline scheduler for non-rotating disks
ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="0",ATTR{queue/scheduler}="deadline"
# set bfq scheduler for rotating disks
ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="1", ATTR{queue/scheduler}="bfq"
# set mq-deadline scheduler for non-rotating nvme-disks
ACTION=="add|change", KERNEL=="nvme[0-9]n1", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="bfq"

Reboot and you’ll see it:

选区_176.png

If you’re using TLP, you’d better change its config too:

vim /etc/default/tlp

References: NVME Enable BFQ Scheduler at boot?

Discuss this post on plumz.me

Comments are hosted on the Chinese main site. This mirror is read-only.

Table of Contents