A Step-by-Step Guide to Intel's Cache Aware Scheduling on Linux

By ● min read

Introduction

Intel's Cache Aware Scheduling (CAS) is a kernel optimization that improves CPU task distribution by considering how each core shares its cache with others. For over a year, Intel engineers have been developing and testing these patches, showing significant performance gains on both Intel and AMD processors. While the patches are not yet merged into the mainline Linux kernel, they are getting closer. This guide walks you through understanding, enabling, and testing CAS on your Linux system—whether you are a kernel developer, a performance enthusiast, or just curious about what's coming next.

A Step-by-Step Guide to Intel's Cache Aware Scheduling on Linux

What You Need

Step-by-Step Guide

Step 1: Understand Cache Topology

Before applying patches, familiarize yourself with your system's cache hierarchy. Run lscpu and lstopo (from hwloc package) to see which cores share L2 and L3 caches. CAS uses this information to place tasks on cores that minimize cache contention. For example, on an AMD Zen 2 processor, each CCX has its own L3; CAS avoids spreading a workload across CCXs if it fits in one.

Step 2: Check Kernel Version

Current CAS patches target the latest mainline kernel (e.g., 6.x). Verify your kernel version with uname -r. If you are on an older LTS kernel, you may need to backport the patches or use a development branch. The patchset often includes changes to kernel/sched/ and include/linux/sched/.

Step 3: Obtain the CAS Patches

Go to the LKML archives (lore.kernel.org) and search for the most recent CAS patch series. Alternatively, find the repository maintained by Intel's scheduler team. Download the patches as a mbox file or apply them via git am. Make sure you have the correct base commit—usually the tip of Linus's tree.

Step 4: Apply and Build the Kernel

  1. Change to your kernel source directory: cd linux
  2. Apply the patches: git am /path/to/patches/*.patch (or patch -p1 < patch_file)
  3. Configure the kernel: make menuconfig. Ensure CONFIG_SCHED_CACHE_AWARE is enabled (under Processor Type and Features). Save and exit.
  4. Build the kernel: make -j $(nproc). Install modules: sudo make modules_install. Install the kernel: sudo make install.
  5. Update bootloader (e.g., sudo update-grub) and reboot into the new kernel.

Step 5: Verify CAS is Active

After boot, check dmesg | grep -i cache for messages about "Cache Aware Scheduling". Also examine /sys/kernel/debug/sched_features (if debugfs is mounted) for the CACHE_AWARE flag. You can also run cat /proc/schedstat to see whether migration counts change.

Step 6: Run Performance Tests

Use benchmarks that benefit from cache locality, such as Phoronix Test Suite tests like CacheBench or memcached. Compare results between a kernel with and without CAS. Intel's internal tests show up to 15% improvement on memory-bound workloads. For AMD CPUs, similar gains appear in workloads that span multiple CCX domains.

Step 7: Tune Parameters (Optional)

CAS introduces new sysctl knobs (kernel.sched_cache_aware_*). Adjust them via sysctl -w to fine-tune aggressiveness. For instance:

sudo sysctl kernel.sched_cache_aware_migration_delay=5

Refer to the documentation (usually in Documentation/scheduler/) for details.

Tips

Intel's Cache Aware Scheduling is a promising addition that will soon land in the upstream kernel. By following this guide, you can be among the first to experience its benefits on your hardware today.

Tags:

Recommended

Discover More

How to Leverage OpenAI Codex in Your Browser with the New Chrome ExtensionHow to Capitalize on OpenAI's AWS Integration: A Strategic Guide for Enterprise AI AdoptionDAEMON Tools Supply Chain Breach: How Official Installers Were WeaponizedPixel 11 RAM Cut: Why Google May Reduce Memory in Its Next FlagshipCARA 2.0: Engineering a Low-Cost, High-Performance Robot Dog for Senior Design