scx_p2dq

Crates.ioscx_p2dq
lib.rsscx_p2dq
version1.0.18
sourcesrc
created_at2025-03-06 19:01:24.272559+00
updated_at2025-06-18 15:07:57.457263+00
descriptionscx_p2dq A simple pick two load balancing scheduler in BPF
homepage
repository
max_upload_size
id1581682
size193,914
Tejun Heo (htejun)

documentation

README

scx_p2dq

Overview

A simple pick 2 load balancing scheduler with (dumb) multi-layer queueing.

The p2dq scheduler is a simple load balancing scheduler that uses a pick two algorithm for load balancing. A fixed number of DSQs are created per LLC with incremental slice intervals. If a task is able to consume the majority of the assigned slice is it dispatched to a DSQ with a longer slice. Tasks that do not consume more than half the slice are moved to shorter slice DSQs. The DSQs with the shortest slice lengths are then determined to be "interactive". All DSQs on the same LLC share the same vtime and there is special handling for (non)interactive tasks for load balancing purposes.

The scheduler handles all scheduling decisions in BPF and the userspace component is only for metric reporting.

Use Cases

p2dq can perform well in a variety of workloads including interactive workloads such as gaming, batch processing and server applications. Tuning of of p2dq for each use case is required.

Configuration

The main idea behind p2dq is being able to classify which tasks are interactive and using a separate dispatch queue (DSQ) for them. Non interactive tasks can have special properties such as being able to be load balanced across LLCs/NUMA nodes. The --autoslice option will attempt to scale DSQ time slices based on the --interactive-ratio. DSQ time slices can also be set manually if the duration/distribution of tasks that are considered to be interactive is known in advance. scxtop can be used to get an understanding of time slice utilization so that DSQs can be properly configured. For desktop systems keeping the interactive ratio small (ex: <5) and using a small number of queues (2) will give a general performance with autoslice enabled.

Commit count: 0

cargo fmt