Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scx_lavd: improve CPU frequency scaling #351

Merged
merged 6 commits into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions scheds/rust/scx_lavd/src/bpf/intf.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ enum consts {
LAVD_ELIGIBLE_TIME_MAX = (LAVD_SLICE_MIN_NS >> 8),

LAVD_CPU_UTIL_MAX = 1000, /* 100.0% */
LAVD_CPU_UTIL_INTERVAL_NS = (25 * NSEC_PER_MSEC),
LAVD_CPU_ID_HERE = ((u32)-2),
LAVD_CPU_ID_NONE = ((u32)-1),
LAVD_CPU_ID_MAX = 512,
Expand All @@ -87,12 +86,13 @@ enum consts {
LAVD_PREEMPT_KICK_MARGIN = (LAVD_SLICE_MIN_NS >> 3),
LAVD_PREEMPT_TICK_MARGIN = (LAVD_SLICE_MIN_NS >> 8),

LAVD_SYS_STAT_INTERVAL_NS = (25 * NSEC_PER_MSEC),
LAVD_TC_PER_CORE_MAX_CTUIL = 500, /* maximum per-core CPU utilization */
LAVD_TC_NR_ACTIVE_MIN = 1, /* num of mininum active cores */
LAVD_TC_NR_OVRFLW = 1, /* num of overflow cores */
LAVD_TC_CPU_PIN_INTERVAL = (100 * NSEC_PER_MSEC),
LAVD_TC_CPU_PIN_INTERVAL_DIV = (LAVD_TC_CPU_PIN_INTERVAL /
LAVD_CPU_UTIL_INTERVAL_NS),
LAVD_SYS_STAT_INTERVAL_NS),

LAVD_GLOBAL_DSQ = 0,
};
Expand Down Expand Up @@ -141,6 +141,12 @@ struct cpu_ctx {
volatile u64 load_run_time_ns; /* total runtime of runnable tasks */
volatile u64 last_kick_clk; /* when the CPU was kicked */

/*
* Information for cpu hotplug
*/
u64 online_clk; /* when a CPU becomes online */
u64 offline_clk; /* when a CPU becomes offline */

/*
* Information used to keep track of latency criticality
*/
Expand All @@ -162,10 +168,16 @@ struct cpu_ctx {
volatile u8 is_online; /* is this CPU online? */
s32 cpu_id; /* cpu id */

/*
* Information for CPU frequency scaling
*/
u32 cpuperf_cur; /* CPU's current performance target */
u32 cpuperf_task; /* task's CPU performance target */
u32 cpuperf_avg; /* EWMA of task's CPU performance target */

/*
* Fields for core compaction
*
* NOTE: The followings MUST be placed at the end of this struct.
*/
struct bpf_cpumask __kptr *tmp_a_mask; /* temporary cpu mask */
struct bpf_cpumask __kptr *tmp_o_mask; /* temporary cpu mask */
Expand Down Expand Up @@ -219,6 +231,7 @@ struct task_ctx_x {
u64 avg_lat_cri; /* average latency criticality */
u64 avg_perf_cri; /* average performance criticality */
u32 nr_active; /* number of active cores */
u32 cpuperf_cur; /* CPU's current performance target */
};


Expand Down
Loading