]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
sched/cache: Introduce infrastructure for cache-aware load balancing
authorPeter Zijlstra (Intel) <peterz@infradead.org>
Wed, 1 Apr 2026 21:52:13 +0000 (14:52 -0700)
committerPeter Zijlstra <peterz@infradead.org>
Thu, 9 Apr 2026 13:49:47 +0000 (15:49 +0200)
commitdf0d98475954d655571979aa061ecb07d7e00392
treecc5ae8bea7965016d76ed8ce1e70d059e8f6bd8a
parentabb12b9b52cfe272c03a859b43a658f0d9cbf285
sched/cache: Introduce infrastructure for cache-aware load balancing

Adds infrastructure to enable cache-aware load balancing,
which improves cache locality by grouping tasks that share resources
within the same cache domain. This reduces cache misses and improves
overall data access efficiency.

In this initial implementation, threads belonging to the same process
are treated as entities that likely share working sets. The mechanism
tracks per-process CPU occupancy across cache domains and attempts to
migrate threads toward cache-hot domains where their process already
has active threads, thereby enhancing locality.

This provides a basic model for cache affinity. While the current code
targets the last-level cache (LLC), the approach could be extended to
other domain types such as clusters (L2) or node-internal groupings.

At present, the mechanism selects the CPU within an LLC that has the
highest recent runtime. Subsequent patches in this series will use this
information in the load-balancing path to guide task placement toward
preferred LLCs.

In the future, more advanced policies could be integrated through NUMA
balancing-for example, migrating a task to its preferred LLC when spare
capacity exists, or swapping tasks across LLCs to improve cache affinity.
Grouping of tasks could also be generalized from that of a process
to be that of a NUMA group, or be user configurable.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Chen Yu <yu.c.chen@intel.com>
Signed-off-by: Tim Chen <tim.c.chen@linux.intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://patch.msgid.link/6269a53221b9439b9ca00d18a9d1946fb64d8cff.1775065312.git.tim.c.chen@linux.intel.com
include/linux/mm_types.h
include/linux/sched.h
init/Kconfig
kernel/fork.c
kernel/sched/core.c
kernel/sched/fair.c
kernel/sched/sched.h