Modern large multicore systems often run multiple workloads that share CPUs under schedulers such as Linux CFS. To keep CPUs busy, these schedulers load-balance runnable work, causing each workload to execute on many cores. This weakens locality at the microarchitectural level: workloads lose reuse in caches, branch predictors, and prefetchers, and interfere more with one another - especially on chiplet-based systems, where spreading execution across cores also spreads it across LLC boundaries. A natural alternative is strict CPU partitioning, but hard partitions leave capacity idle when workloads do not fully use their reserved CPUs. We present Affinity Tailor, a userspace-guided kernel scheduling system built on a key insight: the kernel can preserve locality for workloads that share CPUs by treating demand-sized, topologically compact CPU sets as affinity hints rather than hard partitions. A userspace controller estimates each workload's CPU demand online and assigns a preferred CPU set sized to that demand, chosen to be as disjoint as possible from other workloads while spanning as few LLC domains as possible. The kernel then uses this set as an affinity hint, steering threads toward those CPUs while still allowing execution elsewhere when needed to preserve utilization. Deployed at Google, Affinity Tailor delivers geometric-mean per-CPU throughput gains of 12% on chiplet-based systems and 3% on non-chiplet systems over Linux CFS. Furthermore, faster execution reduces memory residency, yielding per-GB throughput gains of 3-7%. Our findings suggest that future schedulers should treat spatial locality as a first-class objective, even at the expense of work-conservation.
翻译:现代大型多核系统通常在Linux CFS等调度器下运行多个共享CPU的工作负载。为保持CPU繁忙,这些调度器对可运行任务进行负载均衡,导致每个工作负载在多个核心上执行。这削弱了微架构层面的局部性:工作负载在缓存、分支预测器和预取器中失去重用,相互干扰加剧——尤其在基于小芯片的系统中,将执行分散到多个核心也意味着跨越LLC边界。严格的CPU分区是一种自然替代方案,但硬分区会在工作负载未充分使用保留CPU时留下空闲容量。我们提出亲和裁缝,一种基于用户空间引导的内核调度系统,其核心洞见在于:内核可通过将按需大小的拓扑紧凑CPU集合视为亲和性提示(而非硬分区),为共享CPU的工作负载保持局部性。用户空间控制器在线估算每个工作负载的CPU需求,并分配按该需求定制的优选CPU集合,该集合在尽可能与其他工作负载不重叠的同时,尽量跨越最少的LLC域。内核随后将该集合用作亲和性提示,将线程导向这些CPU,同时在需要保持利用率时允许在其他位置执行。在谷歌部署后,亲和裁缝在基于小芯片的系统上比Linux CFS实现12%的每CPU吞吐量几何平均提升,在非小芯片系统上达3%。此外,更快的执行降低了内存驻留,实现每GB吞吐量3-7%的提升。我们的研究结果表明,未来调度器应将空间局部性作为首要目标,即使牺牲工作守恒性也在所不惜。