Supercharge Your Ubuntu 16.04 LTS with XanMod Kernel (includes BFQ)

XanMod is a custom built kernel for Debian and Ubuntu operating systems that comes with couple of tweaks for optimizing the performance. According to the authors, the Kernel has the potential of increasing the performance of high-performing Workstations, Game playback, Media Centers and such like.

Tweaks are applied to the existing core utilities of Linux, the Kernel of the GNU operating system, such as the CPU scheduler, CFQ I/O scheduler (this is the software utility that control how disk read/write requests are managed, and it plays a huge role in making the operating system responsive when the disk is under heavy load), GCC 6 (the GNU C++ compiler), improved cache, swap and CPU ondemand governor (this utility scales up/down the CPU depending on the workload. By carefully optimizing it can be used to improve the efficiency of the scaling operation) and a few others.

To tell you the truth, I’m not a gamer and I don’t have any high-performance workstations either. So why would I recommend the XanMod kernel? I recommend it for the simplest reason because it includes the awesome BFQ I/O scheduler! (also, currently, XanMod is the only known kernel, one that’s being actively updated, that provides BFQ for Debian and Ubuntu as far as I know). I have written extensively about this tool over the years, so I’m not going to re-write all that here. But if this is the first time you’ve heard of it, then this is the deal.

xmk

It’s true that in my personal experience Ubuntu is a very responsive operating system. And by default Ubuntu comes with the ‘deadline’ I/O scheduler (Linux, the kernel, comes with three I/O schedulers -- ‘deadline’, ‘CFQ’ and ‘noop’). But in my experience, on rotational disks Ubuntu usually performs quite well when I switch over to ‘CFQ’. By performing, I simply mean that it improves the responsiveness of the operating system when your disk (s) is busy (trying to open up couple of programs while copying large number of files in the background for instance).

But ‘BFQ’, an I/O scheduler that is written using the existing code bade of ‘CFQ’, vastly improve things! No I’m not simply paraphrasing here, I’m talking from my direct experience. As mentioned before, I have tested the performance of BFQ in the past and have provided some data -- article_1, article_2. In plain simple words, if you would like to have a more responsive operating system, even under heavy disk load, then BFQ is the best of all disk I/O schedulers that I have used (SSDs, HDDs…), and I honestly don’t know why it’s not accepted into the upstream Kernel code yet.

bfq-i-o-scheduler-of-xanmod-kernel-ubuntu-16-04-lts

Anyway, I have been running this Kernel for the past 3 days (I just updated to the latest version -- 4.4.21) in Ubuntu 16.04 LTS and haven’t had any issues so far. Everything is running smoothly, just like under the original Ubuntu Kernel.

XanMod Kernel comes in two different versions, mainly -- Long Term Support (LTS) and the normal releases. I however, urge you to stick with the LTS release, because that’s what Ubuntu 16.04 LTS comes with, and the non-LTS kernel (listed as 4.7 & 4.6 in the XanMod website currently) failed to compile the Kernel module for my Nvidia 920M GPU.

If you don’t have such GPUs and your system only runs on a single Intel GPU, then I guess you’re probably okay to use the latest Kernel releases. Otherwise, stick with the XanMod LTS release.

How to Install it?

1.) First go to the XanMod website and download the preferred Kernel release (I’m using the LTS version).

Update: You can actually get more information about statistics, tweaks etc by visiting the XanMod Forum page as well.

2.) Once the download completes, open the archived file and you’ll see a folder inside. Select the folder and right-click, from the menu choose ‘Extract…’ and when asked for the location, extract it to your ‘Home’ folder.

3.) Now open the terminal window and go to that extracted directory. If you don’t know how to do that, then once you’ve opened up the terminal window, enter the below command:

ls

This will give you a list of files and folders in your Home folder. From that list, find the extracted XanMod Kernel’s folder name and copy it using the mouse, as I’ve demonstrated in the below screenshots.

finding-the-extracted-xanmod-folder-name-in-terminal-ubuntu-16-04-lts

copying-the-extracted-xanmod-folder-name-ubuntu-16-04-lts

Then enter the below command (don’t press Enter yet) and replace the copied folder’s name with the ‘f_name‘, and press Enter:

cd f_name

Now you should be inside the XanMod Kernel’s extracted folder.

4.) Now simply enter the below command to finish the installation.

sudo dpkg -i *.deb

If you don’t see any errors, then you’re good to go. And, if you also don’t want to use BFQ as the I/O scheduler, now you can reboot the computer and from the next boot-up XanMod will be used by Ubuntu 16.04 LTS. If you want to enable BFQ, before rebooting, follow the below procedure also.

5.) Enter the below command into the terminal window:

sudo nano /etc/default/grub

6.) This will open up the GRUB (boot-menu) configuration file in ‘nano’ text editor. Now look for the below text line:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

enabling-bfq-in-grub-configuration-file-ubuntu-16-04-lts

7.) Now simply add the below code into that existing text line (make sure to add a space after ‘splash’) so that it looks like the below one:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash elevator=bfq"

grub-configuration-file-after-enabling-bfq-ubuntu-16-04-lts

8.) Now press ‘Ctl’ + ‘x’ keys on your keyboard to save our changes. When asked, press Enter.

9.) Now we’re almost done. All that is left is to notify GRUB that we’ve added some changes to the configuration file. For that enter the below command:

sudo update-grub2

Now reboot the computer and from your next boot, Ubuntu 16.04 LTS will be using the awesome ‘BFQ’ as the default I/O scheduler (across all the disk drives, if you have multiple drives). If you want to make sure it’s being used, enter the below command:

sudo cat /sys/block/sda/queue/scheduler

When I enter it I get the below output (currently in use I/O scheduler is listed inside a pair of square brackets):

bfq-i-o-scheduler-of-xanmod-kernel-ubuntu-16-04-lts

Enjoy!

Note: I would like to send a Thank You for the XanMod kernel developers, for especially adding the BFQ I/O scheduler to the ‘list’ (it’s such an excellent utility), thank you guys!

25 thoughts on “Supercharge Your Ubuntu 16.04 LTS with XanMod Kernel (includes BFQ)

  1. Hey thank you for this. It was presented and easy to follow.

    Thanks also for all the other articles as well 🙂 Your website can be very useful.

    Cheers

  2. Hello, Gayan, thank you very much for your article!
    Please, feel free to visit Xanmod’s community forum to have a global sight about the whole work done, also with all the information about statistics, cumulative features, additional tweaks, benchmarking results, development process and some other interesting and useful threads.
    I’m sure that you and your readers will enjoy it!
    https://forum.xanmod.org/
    🙂

    • Hi Tropic,

      Thank you for dropping by. And yes, I’ll definitely visit the Forum. I’ve also added a link to it in the article as well. Thanks again 🙂 .

  3. Hi Gayan:

    Just a note about bfq: While it works well for most things, it performs horribbly when copying large data files between USB drives.

    My machine, which stays reasonably responsive (Xenial) with cfq, becomes totally unusable (mouse unresponsive etc,) until the job is complete if using bfq.

    To test, copy a 1GBor larger file between two USB drives or sticks. Since I do this a fair amount, I have had to abandon bfq.

    I would be interested if others have this issue.

    Cheers.

  4. Hi again… I took the time to test all 3 i/o schedulers in the task of copying or moving large data files between two usb drives (in this case two older Sandisk 8GB Cruzers copying a 2.2 GB video between the usb flash drives).

    CFQ = the worst performer
    BFQ = almost as bad as CFQ
    DEADLINE = not perfect but a usable system

    Both bfq and cfq resulted in unusable systems during the above copy. Many, MANY stalls in the transfer.

    Deadline displayed some jerkiness of the mouse, but no stalls and one could at least use the system while the file was being copied.

    It would be interesting to discover if others experience this.

    Cheers

    • Hi,

      Thank you for the input… interesting phenomenon 🙂 . I’ve actually come across some weirdness in a couple of GNU/Linux distributions as well, where when I copy something over to my USB drive (say a reasonably large file – 500 MB), then file copy progress goes from the start point to the very edge within couple of seconds and stays there until the file is actually finished copied to the USB drive. I guess that has something to do with how Linux handles file copy cache, still, this is not something that has been there in the past (it’s present in both GNOME and KDE desktop, therefore it’s probably a Kernel related issue).

      • I had the same thing in Arch Linux distro (GNOME environment).
        Talking about Xanmod: I’m on the latest version (4.8.3-4), but I can’t set BFQ as default scheduler, although I followed your instruction step by step exactly as you described.

    • Please try these settings at /etc/sysclt.conf file:
      vm.dirty_background_bytes=67108864
      vm.dirty_bytes=134217728
      It should work with BFQ, CFQ, Deadline and NOOP.
      😀

  5. Hi Gayan,
    Your instructions made it very easy to install and it works fine on my pc. Silly question I expect, but when Ubuntu next update the image and headers do I need to do anything extra, as I now have XanMod running things?
    Thank you for the tips etc you supply for 16.04, very much appreciated.

    • Hi Tom,

      I honesty don’t remember how Ubuntu makes the selection when it comes to updating the system (whether it simply ignores updating the original kernel, if currently the system is running using a custom-built one). If however, XanMod gets removed from GRUB after an update, then you’ll have to re-install the XanMod kernel.

      Or, the best solution will be to disable Ubuntu kernel updates (this will not disable updating the rest of the system. Ubuntu will simply ignore updating the official kernel). For that you can use the below command:

      sudo apt-mark hold linux-image-generic linux-headers-generic

      Since now you’ve disabled the kernel updates, make sure to look for new versions of XanMod once every while (I’d say once a month at least, just to make sure that the system is protected against major bugs, if any exist).

  6. Hi Gayan,
    Thank you for solving this. I think I will just wait to see what happens. It takes little time and effort to reinstall XanMod, and you have already given the command to check if it is being used. I just needed to clarify what might happen while updating. Thanks again.

  7. Sorry to be away so long there…

    Anyway, this above issue with BFQ only happens with:

    1) very large files, usually starting at around 1GB, and above especially when you get to the 2GB range; there is no problem copying a 500 meg file.
    2) only between USB drives (USB -> USB, not HDD -> USB)
    3) does NOT occur when using rsync; I just found this out today. Rsync works quite well.

    So if the problem does not exist using rysync, but does occur with the cp command, this tells me it is related to cp, and and not bfq except that bfq may act as some form of catalyst for some timing issue in cp.?

    As for me, since rsynce works OK, I am back to using bfq 🙂

  8. Hallo guys and thank you, Gayan, for your plain howto and for introducing me to xanmod. Yesterday I have installed the new 4.9, but the bfq scheduler suddenly disappeared! Did anybody suffer this problem? Tnx in adv

  9. Thank you Alexandre, actually deadline was the scheduler that my linux adopted while missing bfq. But in the latest days I have noticed that xanmod supports again bfq (4.9.2 and later), so problem (if it really was) solved and I’m enjoying it again. Thank you again!

Leave a Comment