Difference between revisions of "Linux-ck"

From ArchWiki
Jump to navigation Jump to search
(Remove kernel compilation. Already merged to kernels.)
Line 13: Line 13:
{{Article summary heading|Related}}
{{Article summary heading|Related}}
{{Article summary wiki|Kernels}}
{{Article summary wiki|Kernels}}
{{Article summary wiki|Kernel Compilation}}
{{Article summary wiki|Modprobed_db}}
{{Article summary wiki|Modprobed_db}}
{{Article summary end}}
{{Article summary end}}

Revision as of 09:51, 18 February 2012

This template has only maintenance purposes. For linking to local translations please use interlanguage links, see Help:i18n#Interlanguage links.

Local languages: Català – Dansk – English – Español – Esperanto – Hrvatski – Indonesia – Italiano – Lietuviškai – Magyar – Nederlands – Norsk Bokmål – Polski – Português – Slovenský – Česky – Ελληνικά – Български – Русский – Српски – Українська – עברית – العربية – ไทย – 日本語 – 正體中文 – 简体中文 – 한국어

External languages (all articles in these languages should be moved to the external wiki): Deutsch – Français – Română – Suomi – Svenska – Tiếng Việt – Türkçe – فارسی

Template:Article summary start Template:Article summary text

Template:Article summary heading Template:Article summary wiki Template:Article summary wiki Template:Article summary end

Linux-ckAUR is a package available in the AUR and in the unofficial linux-ck repo that allows users to run a kernel/headers setup powered by Con Kolivas' ck1 patchset, including the Brain Fuck Scheduler (BFS). Many Archers elect to use this package for the BFS' excellent desktop interactivity and responsiveness under any load situation.

General Package Details

Linux-ck roughly follows the release cycle of upstream. The following are requirements for its release:

  • Upstream code
  • CK's patchset
  • ARCH config/config.x86_64 sets for major version jumps only
  • There are two modifications to the config files:
  1. The options that the ck patchset enable/disable.
  2. The options that the BFQ patchset need to compile without user interaction.

All other options are set to the ARCH defaults outlined in the main kernel's config files. Users are of course free to modify them! The linux-ck package contains an option to switch on the nconfig config editor (see section below). For some suggestions, see CK's BFS configuration FAQ.

Installation Options

Note: As with *any* additional kernel, users will need to manually edit their /boot/grub/menu.lst (if using GRUB) or update their /boot/grub/grub.cfg via "grub-mkconfig -o /boot/grub/grub.cfg" (if using GRUB2) adding an entry (or entries) for linux-ck.
Warning: GRUB2 users - Make sure that you're running grub2 greater than or equal to 1:1.99-5 before installing the linux-ck package. Acknowledgments to Ronald van Haren for fixing the detection scripts to work with linux-ck!

Users have two options to get these kernel packages.

1. Compile the Package From Source

The AUR contains entries for both packages mentioned above. Download and install as you would any other AUR package. linux-ckAUR - current kernel in the 3.x.y series.

Users can customize the linux-ck package via tweaks in the PKGBUILD:

  • Optional nconfig for user specific tweaking.
  • Option to compile a minimal set of modules via a make localmodconfig.
  • Option to bypass the standard ARCH config options and simply use the current kernel's .config file.
  • Optionally set the BFQ I/O scheduler as default.

More details about these options are provided in the PKGBUILD itself via line comments. Be sure to read them if compiling from the AUR!

Note: There are related PKGBUILDs in the AUR for other common modules unique to linux-ck. For example nvidia-ckAUR, lirc-ckAUR, and broadcom-wl-ckAUR.

2. Use Pre-Compiled Packages

If users would rather not spend the time to compile on their own, an unofficial repo maintained by graysky is available to the community.

Note: Repo packages include the BFQ I/O Scheduler compiled as a module. Read the section below for instructions to load it and enable it should you wish to do so.

[Graysky's public key] used for package signing. Pacman v4 will automatically query the public key server, but if users would rather download and manually add the key, do so from the link.

Generic and Optimized Kernel Packages

The repo contains generic packages as well as CPU-specific packages. Many ARCH users are familiar with the concept of a generic kernel package. The official ARCH kernel is available in two flavors (either i686 or x86_64) which are generic packages in that i686 will work with any compatible x86 CPU and x86_64 will work with any compatible x86_64 CPU.

The repo offers users a choice between the corresponding generic linux-ck packages or CPU-specific and optimized linux-ck packages:


  • ck-generic ==> Compiled with generic optimizations suitable for any compatible CPU just like the official ARCH linux package. This is true for both Intel and AMD chips.


  • ck-atom ==> Intel Atom platform specific optimizations. Intel Atom CPUs have an in-order pipelining architecture and thus can benefit from accordingly optimized code.
  • ck-corex ==> Intel Core 2-family including Dual and Quads (Core 2/Newer Xeon/Mobile Celeron based on Core2) and Core i3/i5/i7-family specific optimizations (Gulftown, Bloomfield, Lynnfield, Clarksfield, Arrendale, and Sandy/Ivybridge CPUs).
  • ck-kx ==> AMD K7 (Athlon/Athlon XP)/K8 (Athlon 64, Athlon 64 X2, 23xx Quad-Core Barcelona, Sempron, Sempron 64)/K10-family (Athlon X2 7x50, Phenom X3/X4, Phenom II, Athlon II X2/X3/X4, Sempron 64 (Socket AM3 only), 61xx Eight-Core Magny-Cours) specific optimizations. Enables use of some extended instructions, and passes appropriate optimization flags to GCC.
  • ck-p4 ==> Intel Pentium-4 specific optimizations (P4/P4-based Celeron/Pentium-4 M/Older Xeon).
  • ck-pentm ==> Intel Pentium-M specific optimizations (Pentium-M notebook chips/not Pentium-4 M).

CPU-specific optimization are invoked at compilation by selecting the corresponding option under Processor type and features>Processor family or by setting-up the .config file accordingly. These changes setup make specific gcc options including the $CFLAGS. For more, see the following files:

Add the Repo to /etc/pacman.conf

1) Add the following to /etc/pacman.conf (I placed my entry at the bottom of the file):

Server = http://repo-ck.com/$arch

2) Refresh via pacman -Syy

That's it. To see the contents of the repo, just search as such:

$ pacman -Sl repo-ck

Installation Examples

Use the ck-X group and select the desired packages for installation. There are 6 groups corresponding to the 6 package sets: ck-generic, ck-atom, ck-corex, ck-kx, ck-p4, and ck-pentm.

# pacman -S ck-generic
:: There are 4 members in group ck-generic:
:: Repository repo-ck
   1) broadcom-wl-ck  2) linux-ck  3) linux-ck-headers  4) nvidia-ck

Enter a selection (default=all):

Alternatively, simply direct Pacman to install the packages directly:

# pacman -S linux-ck linux-ck-headers

Current CK Package Offerings

linux-ck and headers Group x86_64 i686 Processor Family Specific Optimizations/Description
linux-ck ck-generic Yes Yes Compiled with generic optimizations suitable for any compatible CPU just like the official ARCH linux package.
linux-ck-atom ck-atom Yes Yes Intel Atom platform specific optimizations.
linux-ck-corex ck-corex Yes Yes Intel Core 2-family specific optimizations including Dual and Quads (Core 2/Newer Xeon/Mobile Celeron based on Core2) as well as Intel Core i3/i5/i7.
linux-ck-kx ck-kx Yes Yes AMD K7 (Athlon/Athlon XP), K8 (Athlon 64, Athlon 64 X2, 23xx Quad-Core Barcelona, Sempron, Sempron 64), and K10-family (Athlon X2 7x50, Phenom X3/X4, Phenom II, Athlon II X2/X3/X4, Sempron 64 (Socket AM3 only), 61xx Eight-Core Magny-Cours) specific optimizations.
linux-ck-p4 ck-p4 No Yes Intel Pentium-4 specific optimizations (P4/P4-based Celeron/Pentium-4 M/Older Xeon).
linux-ck-pentm ck-pentm N/A Yes Intel Pentium-M specific optimizations (Pentium-M notebook chips/not Pentium-4 M).
Nvidia-ck Module Group x86_64 i686 Description
nvidia-ck ck-generic Yes Yes The matching nVidia kernel module based on 290.xx series of Official nVidia drivers for linux-ck.
nvidia-ck-atom ck-atom Yes Yes
nvidia-ck-corex ck-corex Yes Yes
nvidia-ck-kx ck-kx Yes Yes
nvidia-ck-p4 ck-p4 No Yes
nvidia-ck-pentm ck-pentm N/A Yes
Broadcom-wl-ck Module Group x86_64 i686 Description
broadcom-wl-ck ck-generic Yes Yes The matching Broadcom-wl-ck kernel module for linux-ck.
broadcom-wl-ck-atom ck-atom Yes Yes
broadcom-wl-ck-corex ck-corex Yes Yes
broadcom-wl-ck-kx ck-kx Yes Yes
broadcom-wl-ck-p4 ck-p4 No Yes
broadcom-wl-ck-pentm ck-pentm N/A Yes

N/A = Not Available due to hardware limitations.

How to Enable the BFQ I/O Scheduler

Since release 3.0.4-2, the BFQ patchset is applied to the package by default. Users must enable the BFQ scheduler to use it; it is dormant by default.

Globally (for all devices)

Append "elevator=bfq" to the kernel boot line in /boot/grub/menu.lst if using grub or in /etc/default/grub under the GRUB_CMDLINE_LINUX_DEFAULT="quiet" line followed by rebuilding /boot/grub/grub.cfg via the standard "grub-mkconfig -o /boot/grub/grub.cfg" command.

Selectively (for only specified devices)

Direct the kernel to use it on a device-by-device basis. For example, to enable it for /dev/sda simply:

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

To confirm, simply cat the same file:

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

Note that doing it this way will not survive a reboot. To make the change automatically at the next system boot, place the echo line(s) in /etc/rc.local

Note: Users building the PKG from the AUR have an option in the PKGBUILD itself to globally use the BFQ as the default I/O scheduler.


Running Virtualbox with Linux-ck

Virtualbox works just fine with custom kernels such as Linux-ck without the need to keep any of the official ARCH kernel packages on the system (i.e. linux and linux-headers from [core]). The trick to keeping pacman from bringing down the ARCH kernel packages is to install virtualbox with the virtualbox-source package. Why? Wonder kindly responded to FS#26721.

# pacman -S virtualbox virtualbox-source

After pacman finishes, simply generate the kernel modules (for linux-ck) like this (assuming the system is booted into the linux-ck kernel):

# /usr/bin/vboxbuild

Forum Support

Please use this discussion thread to voice comments, questions, suggestions, requests, etc. Note from graysky, "I can add other CPU-specific builds upon request. I just wanna be sure people will actually use them if I take the time to compile them."

Package Trivia/Repo Statistics

  • Various package sets are compiled via a Bash wrapper script for makepkg. The script is publicly accessible at graysky's github repo.
  • Repo statistics are available (popularity of packages, which CPU is most popular, # of downloads, etc.).
Note: The statistics are not updated daily but do give a snapshot of the data.

A Little About the BFS

BFS Design Goals

The BFS has two major design goals:

  1. Achieve excellent desktop interactivity and responsiveness without heuristics and tuning knobs that are difficult to understand, impossible to model and predict the effect of, and when tuned to one workload cause massive detriment to another.
  2. Completely do away with the complex designs of the past for the cpu process scheduler and instead implement one that is very simple in basic design.

For additional information, see the linux-ck#Further_Reading_on_BFS_and_CK_Patchset section of this article.

An Example Video About Queuing Theory

See this video about queuing theory for an interesting parallel with supermarket checkouts. Quote from CK, "the relevance of that video is that BFS uses a single queue, whereas the mainline Linux kernel uses a multiple queue design. The people are tasks, and the checkouts are CPUs. Of course there's a lot more to a CPU scheduler than just the queue design, but I thought this video was very relevant."

Some Performance-Based Metrics: BFS vs. CFS

A major benefit of using the BFS is increased responsiveness. The benefits however, are not limited to desktop feel. Graysky put together some non-responsiveness based benchmarks to compare it to the CFS contained in the "stock" linux kernel. Recognize however, that it was not implicitly designed to provide superior performance. The purpose of the benchmarks was to evaluate the CPU scheduler in the stock Linux kernel against the BFS in the corresponding kernel patched with the ck1 patchset on different machines to see if differences exist and to what degree they scale using performance based metrics even though these end points were never within the scope of primary design goals of the BFS.

It is noteworthy to mention that this is not a novel idea, Phoronix also benchmarking using non-latency based endpoints about which Con subsequently blogged.

[Benchmark results] are available for download in pdf format.

For those not wanting to see the data and just wanting the highlights:

  • 7 different machines ranging from 1 to 16 cores were benchmark using both a make and a x264-based video benchmark.
  • Each machine ran both the "standard" linux kernel (linux-3.0.1-2 from [core]) and the ck1-patched version of this kernel (linux-ck-3.0.6-2 from graysky's unofficial repo).
  • All 7 machines preformed better using the linux-ck package on the make benchmark.
  • x264 encoding results were mixed. 4 machines performed better on the BFS scheduler; 1 gave same results; and 3 performed worse. It should be noted that an experimental version (svn) of handbrake was used for these tests.

Further Reading on BFS and CK Patchset

Linux-ck Package Changelog