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. A Walkthrough Of The New 32 System Open-Source Linux Benchmarking Test Farm
  2. Habey MITX-6771: Mini-ITX Board With Quad-Core J1900 Bay Trail
  3. OCZ Vector 150 SSD On Linux
  4. Noctua i4 CPU Cooler: Great For Cooling High-End LGA-2011v3 CPUs
Latest Linux Articles
  1. AMD Kaveri: Open-Source Radeon Gallium3D vs. Catalyst 14.12 Omega Driver
  2. 12-Way AMD Catalyst 14.12 vs. NVIDIA 346 Series Linux GPU Comparison
  3. AMD Catalyst 14.12 Omega Driver Brings Mixed Results For Linux Users
  4. 6-Way Winter 2014 Linux Distribution Comparison
Latest Linux News
  1. MIPS R6 Architecture Now Supported By GCC
  2. LowRISC To Feature Tagged Memory & Minion Cores
  3. Intel Skylake Audio Support For Linux 3.19
  4. After 10+ Years, NetworkManager Reaches v1.0
  5. VDPAU Updated To v0.9
  6. An Open Hardware Random Number Generator Proposed
  7. LLVM 3.6 Will Be Branched Next Month
  8. Opera Browser Puts Out Linux Updates For The Holidays
  9. GNOME Shell 3.15.3 Adds Support For High-Contrast Themes
  10. Linux 3.19: ThinkPad Muting Redone, New Dell Backlight Support, Acer Is Banging
Latest Forum Discussions
  1. XLennart: A Game For Systemd Haters With Nothing Better To Do
  2. Need some hand holding with upgrading xserver
  3. Updated and Optimized Ubuntu Free Graphics Drivers
  4. Debian init discussion in Phoenix Wright format
  5. The New SuperTuxKart Looks Better, But Can Cause GPU/Driver Problems
  6. FPS capped on Linux (AMD fglrx drivers)
  7. Are there an app using HSA ?
  8. Bench specific mount point