1. Computers
  2. Display Drivers
  3. Graphics Cards
  4. Memory
  5. Motherboards
  6. Processors
  7. Software
  8. Storage
  9. Operating Systems


Facebook RSS Twitter Twitter Google Plus


Phoronix Test Suite

OpenBenchmarking.org

Linux Dynticks Being Extended For Performance Wins

Linux Kernel

Published on 18 December 2012 03:34 AM EST
Written by Michael Larabel in Linux Kernel
5 Comments

Dynticks, the Dynamic Tick Timer for allowing the Linux kernel to skip ticks while idling and resume to running at full HZ when encountering load, is in the process of being extended. Developers are working on making Dynticks work even under select workloads in order to enhance the performance of CPU-intensive tasks.

Dynticks up to this point has been a power savings win for Linux systems that are frequently idling since the tick timer goes off much less frequently. However, Dynticks can also be a performance win if the kernel can tick less while experiencing high CPU load. Developers have been working towards this feat and some of the bits are likely to be merged into the Linux 3.8 kernel.

There's an outstanding pull request for full Dynticks support for printk, the Linux kernel print function, in Linux 3.8. The pull request can be found below and describes what's being done for making Dynticks more relevant to CPU-intense workloads.

Frederic Weisbecker wrote:
We are currently working on extending the dynticks mode to broader contexts than just idle. Under some conditions on a busy CPU, the tick can be avoided (no need of preemption for one task running, no need of RCU state machine maintainance in userspace, etc...).

The most popular application of this is the implementation of CPU isolation. On HPC workloads, where people run one task per-CPU in order to maximize the CPU performances, the kernel sets itself too much on the way with these often unnecessary interrupts.

The result is a performance loss due to stolen CPU time and cache trashing of the userspace workset.

Now CPU isolation is the most famous user. I expect more. For example we should be able to avoid the tick when we run in guest mode. And more generally this may be a win for most CPU-bound workloads.

So in order to implement this full dynticks mode, we need to find alternatives to handle the many maintainance operations performed periodically and turn them to more one-shot event driven solutions.

printk() is part of the problem. It must be safely callable from most places and for that purpose it performs an asynchronous wake up of the readers by probing on the tick for pending messages and readers through printk_tick().

Of course if we use printk while the tick is stopped, the pending readers may not be woken up for a while. So a solution to make printk() working even if the CPU is in dynticks mode
is to use the irq_work subsystem. This subsystem is typically able to fire self-IPIs. So when printk() is called, it now enqueues an irq_work that does the asynchronous wakeup:

* If the tick is stopped, it raises a self-IPI
* If the tick is running periodically then don't fire a self-IPI but wait for the next tick to handle that instead (irq work probes on the timer tick). This avoids self-IPIs storm in case of frequent printk() in short periods of time.

I know this is a sensitive area. We want printk() to stay minimal and not rely too much on other subsystems that add complications and that may use printk themselves. That's why we chose irq_work because:

- It's pretty small and self-contained
- It's lockless
- It handles most recursivity cases (if it uses printk() itself from the IPI path, this won't fire another IPI)

But because it's sensitive, I'm proposing it as an RFC pull request.
A win for most CPU-bound workloads? Yes please. Linus has yet to respond whether he will honor this merge request for the Linux 3.8 release.

About The Author
Michael Larabel is the principal author of Phoronix.com and founded the web-site in 2004 with a focus on enriching the Linux hardware experience and being the largest web-site devoted to Linux hardware reviews, particularly for products relevant to Linux gamers and enthusiasts but also commonly reviewing servers/workstations and embedded Linux devices. Michael has written more than 10,000 articles covering the state of Linux hardware support, Linux performance, graphics hardware drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated testing software. He can be followed via and or contacted via .
Latest Linux Hardware Reviews
  1. Even With Re-Clocking, Nouveau Remains Behind NVIDIA's Proprietary Linux Driver
  2. The Power Consumption & Efficiency Of Open-Source GPU Drivers
  3. AMD R600g/RadeonSI Performance On Linux 3.16 With Mesa 10.3-devel
  4. Intel Pentium G3258 On Linux
Latest Linux Articles
  1. Updated Source Engine Benchmarks On The Latest AMD/NVIDIA Linux Drivers
  2. Nouveau vs. Radeon vs. Intel Tests On Linux 3.16, Mesa 10.3-devel
  3. KVM Benchmarks On Ubuntu 14.10
  4. X.Org Server 1.16 Officially Released With Terrific Features
Latest Linux News
  1. GStreamer VA-API Plug-In Update Adds New Features
  2. Qt 5.4 Going Into Feature Freeze Next Week With Exciting Changes
  3. OpenSUSE Factory Turns Into Rolling Release Distribution
  4. "The World's Most Highly-Assured OS" Kernel Open-Sourced
  5. NVIDIA Is Working Towards VDPAU H.265/HEVC Support
  6. Hawaii Bug-Fixes Start Hitting Mainline RadeonSI Gallium3D
  7. The FFmpeg vs. Libav War Continues In Debian Land
  8. Grand Theft Auto Running On Direct3D Natively On Linux Shows Gallium3D Potential
  9. GCC As A Just-In Time Compiler Is An Interesting Project
  10. Age Of Wonders III Is Still Being Ported To Linux
Latest Forum Discussions
  1. Linus Torvalds On GCC 4.9: Pure & Utter Crap
  2. AMD Athlon 5350 APU On Linux
  3. Updated and Optimized Ubuntu Free Graphics Drivers
  4. Debian + radeonsi
  5. Open-source drivers on ATI R7 260X
  6. List of Linux friendly Kickstarter projects
  7. Porting Mesa to the Playstation 2
  8. ASRock AM1H-ITX: One Of The Best AM1 Mini-ITX Motherboards