How to Evaluate Intel's Cache Aware Scheduling on Linux Before Mainline Merge

Introduction

Intel's Cache Aware Scheduling (CAS) is a set of kernel patches that improve task scheduling by taking CPU cache topology into account. For over a year, Intel engineers have been refining these patches, and they are now close to being merged into the mainline Linux kernel. Early tests on both Intel and AMD CPUs show significant performance gains, especially in workloads that are sensitive to cache contention. This step-by-step guide will walk you through obtaining, applying, and testing the CAS patches on your own system, allowing you to experience the benefits before the official merge.

How to Evaluate Intel's Cache Aware Scheduling on Linux Before Mainline Merge

What You Need

Step-by-Step Guide

Step 1: Obtain the Cache Aware Scheduling Patches

The CAS patches are usually posted on the Linux kernel mailing list (LKML) by Intel engineers. To get the latest version:

  1. Visit the LKML archives or use a tool like git am from Intel's public kernel tree. Search for patches with "cache aware scheduling" or "sched/cache" in the subject.
  2. Alternatively, fetch the entire series from a repository such as git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git (look for the sched/core branch which may contain CAS).
  3. Save the patch series as a single file (e.g., cas_v7.patch).

Step 2: Apply the Patches to Your Kernel Source

Once you have the kernel source and the patch series, apply them:

  1. Navigate to your kernel source directory: cd ~/linux
  2. Apply the patches in order: patch -p1 < ~/cas_v7.patch (or use git am if you cloned a git tree).
  3. Resolve any conflicts if they arise (usually rare for a clean base kernel).

Step 3: Configure the Kernel for Cache Aware Scheduling

Ensure that CAS is enabled in the kernel configuration:

  1. Run make menuconfig (or make nconfig).
  2. Navigate to Processor type and features > Scheduler features.
  3. Enable "Intel Cache Aware Scheduling" (or similar option, may be labeled SCHED_CACHE). If not visible, check that the correct CPU family is selected.
  4. Also enable any related options like NUMA and SCHED_MC for best results.
  5. Save and exit.

Step 4: Build and Install the Custom Kernel

Compile the kernel with CAS support:

  1. Build the kernel: make -j$(nproc)
  2. Build modules: make modules_install
  3. Install the kernel: make install
  4. Update your bootloader (e.g., update-grub for GRUB).

Step 5: Reboot and Select the New Kernel

After installation, restart your system and choose the custom kernel from the boot menu. Confirm that the kernel version matches the one you built (check uname -r).

Step 6: Verify Cache Aware Scheduling is Active

Check that CAS is running:

  1. Look at kernel messages: dmesg | grep -i cache – you should see lines about "Cache Aware Scheduling" or similar.
  2. Inspect scheduler flags: cat /sys/kernel/debug/sched_features – look for CACHE_AWARE in the list (if debugfs is mounted).

Step 7: Benchmark and Compare Performance

To see the benefits of CAS, run workloads that stress CPU cache coherence:

  1. Use a benchmark like stress-ng with cache thrashing flags: stress-ng --cache 4 --cache-ops 1000000
  2. Alternatively, run your typical multitasking workload (e.g., compilation + video encoding).
  3. Record performance metrics with perf stat focusing on cache misses (LLC-load-misses) and task migration rates.
  4. Repeat the same tests without CAS (boot a kernel without CAS patches) and compare results.

Tips for Success

Recommended

Discover More

AI and Energy: A New American Partnership Unveiled at SCSP ExpoNavigating a Cyberattack on Learning Platforms: Lessons from the Canvas Incident7 Essential Tips for Tailoring Cloud Provider Views in Grafana CloudcPanel Authentication Flaw: 6 Urgent Steps to Secure Your Server10 Ways Guaranteed Minimum Income Can Revive the American Dream