How to enable the BFQ I/O scheduler on kernel >=4.12

the little testing I have done with my ultrabook, and I haven’t notice any problems with the 4.12.x kernel …yet. And my Arch desktop has both 4.12.x kernel (using bfq) and the ck-kernel (4.11.x) where I need to build few big aur pkgs like ffmpeg-full I have never notice any issues

@AlmAck: apparently this is planned for 4.13: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers/scsi?id=5c279bd9e40624f4ab6e688671026d6005b066fa&h=master

a side note: manjaro had some issues with making bfq default in 4.12 https://github.com/manjaro/packages-core/issues/77 (…manjaro as been using bfq by default way before 4.12) as workaround solution was “bfq@.service” file

apparently this udev rule should work also (to make bfq default):

ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/scheduler}="bfq"

“In order to enable blk-mq subsystem the kernel has to be configured with option CONFIG_SCSI_MQ_DEFAULT=y or pass parameter scsi_mod.use_blk_mq=1 in boot loader.”

source is from the ck-kernel’s AUR comment section …which also has/had problems with making bfq default with 4.12.

Thanks for the inputs @ahjolinna
Following my initial post I was able to set bfq as default, the bfq@.service is for sure an other option.
When Linus releases bfq as default schedule we will follow the upstream decision and build the kernel with that scheduler, but until now, if the performance difference is not huge we will stay with the cfq.

@AlmAck: bfq is designed mainly for desktop usage so I highly doubt we ever see it as default scheduler when the Linux kernel is not desktop only kernel!

and as chakraOS is a desktop only distro it would make common sense that configurations would lean towards stuff that benefits desktop over other platform…but this is just me

I agree with you, chakra is a desktop distro and we should provide the best experience to our users. I would like to make some more tests, and have some other feedback from our @testers team.

1 Like

I have 2 Chakra installed on the same ssd so i can compare schedulers. Just give me some simple how-to about BFQ.

as root at run time:

echo bfq > /sys/block/sda/queue/scheduler

or every boot with systemd-tmpfiles
create in /etc/tmpfiles.d/bfq.conf

w /sys/block/sd*/queue/scheduler - - - - bfq

definitive the best experience deliver kernel with the ck patch set…

Hmm, there are no BFQ scheduler in my system.

echo bfq > /sys/block/sda/queue/scheduler
-bash: echo: write error: Invalid argument

cat /sys/block/sda/queue/scheduler
noop deadline [cfq]

How can i get BFQ? I’m on testing repo.

Hey, make sure to check the instructions on the first post of this thread.

do so but only with ssd because hdd can’t handle multi queue

I did, but it’s not doing anything.

My cmdline:
GRUB_CMDLINE_LINUX_DEFAULT=‘quiet splash=silent logo.nologo acpi_osi=Linux video.use_native_backlibacklight=1 audit=0 scsi_mod.use_blk_mq=1’

After update-grub and reboot, i still only get the basic ones. noop deadline [cfq], using this kernel:
4.12.4-1-CHAKRA #1 SMP PREEMPT Tue Aug 1 18:19:44 CEST 2017 x86_64 GNU/Linux

with linux 4.12-4 and after reboot?
please check your kernel commandline

cat /proc/cmdline
[tom@frija ~]$ uname -r
4.12.4-1-CHAKRA
[tom@frija ~]$ cat /proc/cmdline 
initrd=/initramfs-linux.img  root=/dev/sda2  rw quiet config_scsi_mq_default=y scsi_mod.use_blk_mq=1  resume=/dev/sda4
[tom@frija ~]$ cat /sys/block/sda/queue/scheduler 
mq-deadline kyber [bfq] none

Yes, with 4.12-4 + reboot.

Something is quite odd here:

cat /proc/cmdline
BOOT_IMAGE=/boot/vmlinuz-linux root=UUID=8ac38f81-6f87-4ffd-9626-9352a60b8ac5 rw quiet resume=UUID=578f2ca5-2c3b-482b-adbe-23d4cae759a2

My /etc/default/grub file got ignored?

please try and check /boot/grub/grub.cfg

sudo grub-mkconfig -o /boot/grub/grub.cfg

btw you can edit /boot/grub/grub.cfg

sudoedit /boot/grub/grub.cfg

Only the grub.cfg’s manual editing worked. Strange…

Btw now i got the new schedulers, i will be back after some testing with the phoronix test suite. The other 3 are already tested.

The results are here. https://pastebin.com/M8dcnABT

I did x264, x264-opencl, ffmpeg, 7zip, lzma and unigine benchmarks with all six schedulers. There are extremly small differences between them, and there are no clear winner.

edit:
I run the tests on SSD, with 8-core FX-8320 running at 4GHz, with 16GB ram and an RX460 4GB vga.

2 Likes

with your system you will never feel the scheduler working i suppose.
a bit about what the scheduler does https://www.youtube.com/watch?v=F5Ri_HhziI0

you can feel the schedulers work if you don’t feel latency while a (back round) process does heavy I/O

1 Like

Then i may also run some test on my much weeker laptop.

a litte about benchmarking tools https://wiki.archlinux.org/index.php/Benchmarking#interbench

more about BFQ http://algogroup.unimore.it/people/paolo/disk_sched/

Hi, following first post instructions, I didn’t find bfq as default scheduler:

sudo cat /sys/block/sda/queue/scheduler [mq-deadline] kyber bfq none

Is this a problem?

EDIT: sorry, I found that bfq is only for SSD. And the SDD is using bfq.
mq-deadline is fine fo HDDs?

“mq” stands for “multi queue” and it isn’t a good idea to use multi queue with a HDD because thy can handle only one queue.
you can use the deadline scheduler on HDD if you want but you shouldn’t use multi queue because it will sacrifice performance

I’m confused: mq-deadline is only available:

sudo cat /sys/block/sda/queue/scheduler
[mq-deadline] kyber bfq none