linux/drivers/base
Davi Chaves Azevedo 3cb0243767 sched/cache: Refresh LLC capacity across CPU hotplug, to fix capacity underestimation bug
The scheduler scales LLC capacity by the fraction of cache-sharing CPUs
covered by a domain:

  llc_bytes = cache_size * span_weight / shared_weight

During CPU teardown, sched_cpu_deactivate() rebuilds scheduler domains
before cacheinfo_cpu_pre_down() removes the CPU from shared_cpu_map. The
new domains therefore use the old sharing weight. The later call to
sched_update_llc_bytes() looks up the departing CPU's sd_llc, which has
already been detached, and returns without correcting the surviving CPUs.

On a Ryzen 5 7535U with twelve logical CPUs sharing a 16 MiB LLC,
offlining one SMT sibling left the remaining CPUs with:

  llc_bytes = floor(16777216 * 11 / 12) = 15379114 bytes

The correct capacity is still 16777216 bytes. On systems with active
cache-aware scheduling, an underestimated capacity can cause
exceed_llc_capacity() to reject aggregation for a process whose footprint
would fit. Unchanged cpuset partitions sharing the physical cache can
also retain stale capacity when a CPU comes online in another partition.

Pass the cache-sharing mask already retained by cacheinfo to the
scheduler update. Refresh every surviving CPU using its own LLC domain
so that each partition receives the correct share. This also preserves
the correction needed as cache-sharing maps grow during boot.

Keep the existing CPU-hotplug and scheduler-domain synchronization. The
update remains on the hotplug path; no steady-state scheduling operation
or persistent allocation is added.

Fixes: 7030513a08 ("sched/cache: Calculate the LLC size and store it in sched_domain")
Signed-off-by: Davi Chaves Azevedo <davichazbh@gmail.com>
Signed-off-by: Tim Chen <tim.c.chen@linux.intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Reviewed-by: Chen Yu <yu.c.chen@intel.com>
Reviewed-by: Tim Chen <tim.c.chen@linux.intel.com>
Reviewed-by: K Prateek Nayak <kprateek.nayak@amd.com>
Tested-by: Chen Yu <yu.c.chen@intel.com>
Tested-by: K Prateek Nayak <kprateek.nayak@amd.com>
Cc: <stable@kernel.org> # v7.2.x
Link: https://patch.msgid.link/6751d93e15889e624796c74db0bfe66603d60b1b.1790035273.git.tim.c.chen@linux.intel.com
2026-09-22 10:50:54 +02:00
..
firmware_loader firmware_loader: do not queue completed sysfs fallback requests 2026-08-06 23:38:16 +02:00
power PM: sleep: Unblock runtime PM when device prepare fails 2026-08-20 23:18:15 +02:00
regmap regmap: Updates for v7.3 2026-08-19 09:32:57 -07:00
test drivers: base: test: DRIVER_PE_KUNIT_TEST should not select OF 2026-09-01 16:59:48 +02:00
arch_topology.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
attribute_container.c driver core: attribute_container: Unwind device_add() on attr failure 2026-07-18 16:07:22 +02:00
auxiliary_sysfs.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
auxiliary.c ACPI support updates for 7.1-rc1 2026-04-13 19:25:07 -07:00
base.h driver core: constify group arrays arguments in driver_add_groups and driver_remove_groups 2026-05-22 13:32:05 +02:00
bus.c driver core: reject devices with unregistered buses 2026-05-02 17:50:50 +02:00
cacheinfo.c sched/cache: Refresh LLC capacity across CPU hotplug, to fix capacity underestimation bug 2026-09-22 10:50:54 +02:00
class.c kernfs: pass struct ns_common instead of const void * for namespace tags 2026-04-09 14:36:52 +02:00
component.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
container.c
core.c driver core: avoid repeatedly printing the same 'Fixed dependency' log 2026-07-17 15:44:44 +02:00
cpu.c cpu: Use sysfs_emit() for cpumask show callback 2026-07-22 15:38:37 -04:00
dd.c driver core: add driver name to probe debug print 2026-07-10 16:56:07 +02:00
devcoredump.c devcoredump: Remove exit call 2026-05-22 13:26:51 +02:00
devres.c devres: rename and export set_node_dbginfo() 2026-03-18 00:02:59 +01:00
devtmpfs.c devtmpfs: create private mount namespace 2026-06-29 10:54:43 +02:00
driver.c driver core: remove driver_set_override() 2026-05-30 22:25:50 +02:00
faux.c driver core: faux: clean up init error handling 2026-05-02 17:50:50 +02:00
firmware.c
hypervisor.c
init.c driver core: make software nodes available earlier 2026-04-04 00:33:49 +02:00
isa.c isa: refactor code to remove nested blocks 2026-07-03 23:14:59 +02:00
Kconfig mm.git review status for linus..mm-stable 2026-08-27 09:17:06 -07:00
Makefile drivers/base, mm: move arch_numa.c to mm/ 2026-08-24 18:43:10 -07:00
map.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
memory.c mm/memory_hotplug: add mhp_online_type_to_str() and export string helpers 2026-08-06 18:56:58 -07:00
module.c driver core: fix path of /sys/module in comment 2026-06-29 01:11:14 +02:00
node.c drivers/base/memory: make memory block get/put explicit 2026-06-02 15:22:12 -07:00
physical_location.c Convert more 'alloc_obj' cases to default GFP_KERNEL arguments 2026-02-21 20:03:00 -08:00
physical_location.h
pinctrl.c driver core: Replace dev->of_node_reused with dev_of_node_reused() 2026-04-26 23:50:20 +02:00
platform-msi.c platform-msi: Remove stale comment 2026-02-26 10:48:19 +01:00
platform.c driver core: platform: unify release path 2026-07-20 00:49:16 +02:00
property.c treewide: refresh kmalloc_obj() conversions 2026-09-04 21:37:00 -07:00
soc.c driver core: soc: Unregister bus on early device registration failure 2026-07-18 16:07:22 +02:00
swnode.c software node: Fix software_node_get_reference_args() with index -1 2026-07-18 16:07:22 +02:00
syscore.c syscore: Pass context data to callbacks 2025-11-14 10:01:52 +01:00
topology.c sysfs: treewide: switch back to attribute_group::bin_attrs 2025-06-17 10:44:15 +02:00
trace.c
trace.h
transport_class.c drivers: base: Remove statistics group if encryption group not created 2026-07-18 16:07:22 +02:00