]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
sched/cache: Handle moving single tasks to/from their preferred LLC
authorTim Chen <tim.c.chen@linux.intel.com>
Wed, 1 Apr 2026 21:52:26 +0000 (14:52 -0700)
committerPeter Zijlstra <peterz@infradead.org>
Thu, 9 Apr 2026 13:49:51 +0000 (15:49 +0200)
commit714059f79ff0ba976cb75360064583c78bbc6f8e
tree5a2754f6429d1cc70d7c1c2c13382141cdd72403
parente4c9a4cb244a273c58e8fd86d7c04e2502822e64
sched/cache: Handle moving single tasks to/from their preferred LLC

Cache aware scheduling mainly does two things:
1. Prevent task from migrating out of its preferred LLC if not
   nessasary.
2. Migrating task to their preferred LLC if nessasary.

For 1:
In the generic load balance, if the busiest runqueue has only one task,
active balancing may be invoked to move it away. However, this migration
might break LLC locality.

Prevent regular load balance from migrating a task that
prefers the current LLC. The load level and imbalance do not warrant
breaking LLC preference per the can_migrate_llc() policy. Here, the
benefit of LLC locality outweighs the power efficiency gained from
migrating the only runnable task away.

Before migration, check whether the task is running on its preferred
LLC: Do not move a lone task to another LLC if it would move the task
away from its preferred LLC or cause excessive imbalance between LLCs.

For 2:
On the other hand, if the migration type is migrate_llc_task, it means
that there are tasks on the env->src_cpu that want to be migrated to
their preferred LLC, launch the active load balance anyway.

Co-developed-by: Chen Yu <yu.c.chen@intel.com>
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/9b816d8c27fabf2a9c0e1f61a6b90afe8ec4ad52.1775065312.git.tim.c.chen@linux.intel.com
kernel/sched/fair.c