Meta’s ads serving fleet processes more than 5 million requests per second, so millisecond-scale latency changes can affect ads relevance and advertiser ROI. During a move from kernel 6.4 with CFS to kernel 6.9, the team observed a latency regression associated with EEVDF and used sched_ext, an upstream BPF-based framework, to encode ads-specific scheduling priorities. The policy soft-partitions CPUs between latency-critical request-path threads and less-sensitive work, adjusts pool sizes with load-based heuristics, and runs as a user-space binary that loads BPF, enabling policy changes without rebuilding or reinstalling the kernel. Initial results were a 28% reduction in ads retrieval p99 latency, 3.28 megawatts of fleet power savings, and a 1.1% increase in weighted ads ranked; two later user-space updates delivered an additional 60% p99 reduction and an 18% decrease in critical-path timeout errors, with iterations shipping in days rather than months.
Context
A Linux kernel upgrade from 6.4 with CFS to 6.9 exposed a latency regression associated with the EEVDF scheduler, reducing the number of ads ranked in responses and forcing some ads hosts to remain on the older kernel. The work addressed the impact of latency on Meta’s high-volume ads serving fleet.
Approach / What changed
The Ads and Linux Kernel teams used sched_ext to implement an ads-specific BPF scheduling policy. It soft-partitions CPUs for latency-critical and less-sensitive work, dynamically adjusts pool sizes with load-based heuristics, and is packaged as a user-space binary so policies can be replaced without rebuilding or reinstalling the kernel.
Takeaways
1
sched_ext exposes event-driven callbacks for thread wake-up, enqueue, dispatch, and idle transitions, allowing scheduling decisions to incorporate workload-specific thread importance.
2
The policy keeps related work on the same CPUs over time, improving last-level cache locality and reducing costly DRAM access.
3
sched_ext was upstreamed into Linux v6.12, making workload-specific scheduling policies available without requiring operators to fork the kernel.
BPF is not one hook but a set of attachment points, and each one sees different traffic. This diagram maps XDP, TC, socket-level BPF LSM, and sched_ext so you can pick the layer that can actually enforce your rule.
Keep reading
Related reading
The Good Stuff
Paid picks we use ourselves. Links carry a referral code — a subscription through one earns us a commission at no extra cost to you.