mirror of
https://github.com/sched-ext/scx.git
synced 2024-12-04 08:17:11 +00:00
scx_lavd: Log out the number of cross-domain task migration
Collect and log out the number of task migration across compute domains. Signed-off-by: Changwoo Min <changwoo@igalia.com>
This commit is contained in:
parent
b313a96714
commit
ed14a4ca91
@ -84,6 +84,7 @@ struct sys_stat {
|
||||
volatile u64 nr_sched; /* total scheduling so far */
|
||||
volatile u64 nr_perf_cri; /* number of performance-critical tasks scheduled */
|
||||
volatile u64 nr_lat_cri; /* number of latency-critical tasks scheduled */
|
||||
volatile u64 nr_x_migration; /* number of cross domain migration */
|
||||
volatile u64 nr_big; /* scheduled on big core */
|
||||
volatile u64 nr_pc_on_big; /* performance-critical tasks scheduled on big core */
|
||||
volatile u64 nr_lc_on_big; /* latency-critical tasks scheduled on big core */
|
||||
|
@ -129,6 +129,7 @@ struct cpu_ctx {
|
||||
/*
|
||||
* Information for statistics.
|
||||
*/
|
||||
volatile u32 nr_x_migration;
|
||||
volatile u32 nr_perf_cri;
|
||||
volatile u32 nr_lat_cri;
|
||||
|
||||
|
@ -1179,7 +1179,7 @@ static bool consume_task(s32 cpu, struct cpu_ctx *cpuc, u64 now)
|
||||
* If there is a starving DSQ, try to consume it first.
|
||||
*/
|
||||
if (consume_starving_task(cpu, cpuc, now))
|
||||
return true;
|
||||
goto x_domain_migration_out;
|
||||
|
||||
/*
|
||||
* Try to consume from CPU's associated DSQ.
|
||||
@ -1222,11 +1222,19 @@ static bool consume_task(s32 cpu, struct cpu_ctx *cpuc, u64 now)
|
||||
continue;
|
||||
|
||||
if (consume_dsq(cpu, dsq_id, now))
|
||||
return true;
|
||||
goto x_domain_migration_out;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
/*
|
||||
* Task migration across compute domains happens.
|
||||
* Update the statistics.
|
||||
*/
|
||||
x_domain_migration_out:
|
||||
cpuc->nr_x_migration++;
|
||||
return true;
|
||||
}
|
||||
|
||||
void BPF_STRUCT_OPS(lavd_dispatch, s32 cpu, struct task_struct *prev)
|
||||
|
@ -38,6 +38,7 @@ struct sys_stat_ctx {
|
||||
u32 nr_sched;
|
||||
u32 nr_perf_cri;
|
||||
u32 nr_lat_cri;
|
||||
u32 nr_x_migration;
|
||||
u32 nr_big;
|
||||
u32 nr_pc_on_big;
|
||||
u32 nr_lc_on_big;
|
||||
@ -94,6 +95,9 @@ static void collect_sys_stat(struct sys_stat_ctx *c)
|
||||
c->nr_lat_cri += cpuc->nr_lat_cri;
|
||||
cpuc->nr_lat_cri = 0;
|
||||
|
||||
c->nr_x_migration += cpuc->nr_x_migration;
|
||||
cpuc->nr_x_migration = 0;
|
||||
|
||||
/*
|
||||
* Accumulate task's latency criticlity information.
|
||||
*
|
||||
@ -260,6 +264,7 @@ static void update_sys_stat_next(struct sys_stat_ctx *c)
|
||||
stat_next->nr_sched >>= 1;
|
||||
stat_next->nr_perf_cri >>= 1;
|
||||
stat_next->nr_lat_cri >>= 1;
|
||||
stat_next->nr_x_migration >>= 1;
|
||||
stat_next->nr_big >>= 1;
|
||||
stat_next->nr_pc_on_big >>= 1;
|
||||
stat_next->nr_lc_on_big >>= 1;
|
||||
@ -272,6 +277,7 @@ static void update_sys_stat_next(struct sys_stat_ctx *c)
|
||||
stat_next->nr_sched += c->nr_sched;
|
||||
stat_next->nr_perf_cri += c->nr_perf_cri;
|
||||
stat_next->nr_lat_cri += c->nr_lat_cri;
|
||||
stat_next->nr_x_migration += c->nr_x_migration;
|
||||
stat_next->nr_big += c->nr_big;
|
||||
stat_next->nr_pc_on_big += c->nr_pc_on_big;
|
||||
stat_next->nr_lc_on_big += c->nr_lc_on_big;
|
||||
|
@ -711,6 +711,7 @@ impl<'a> Scheduler<'a> {
|
||||
let nr_sched = st.nr_sched;
|
||||
let pc_pc = Self::get_pc(st.nr_perf_cri, nr_sched);
|
||||
let pc_lc = Self::get_pc(st.nr_lat_cri, nr_sched);
|
||||
let pc_x_migration = Self::get_pc(st.nr_x_migration, nr_sched);
|
||||
let nr_big = st.nr_big;
|
||||
let pc_big = Self::get_pc(nr_big, nr_sched);
|
||||
let pc_pc_on_big = Self::get_pc(st.nr_pc_on_big, nr_big);
|
||||
@ -730,6 +731,7 @@ impl<'a> Scheduler<'a> {
|
||||
nr_sched,
|
||||
pc_pc,
|
||||
pc_lc,
|
||||
pc_x_migration,
|
||||
pc_big,
|
||||
pc_pc_on_big,
|
||||
pc_lc_on_big,
|
||||
|
@ -37,6 +37,9 @@ pub struct SysStats {
|
||||
#[stat(desc = "% of latency-critical tasks")]
|
||||
pub pc_lc: f64,
|
||||
|
||||
#[stat(desc = "% of cross domain task migration")]
|
||||
pub pc_x_migration: f64,
|
||||
|
||||
#[stat(desc = "% of tasks scheduled on big cores")]
|
||||
pub pc_big: f64,
|
||||
|
||||
@ -63,13 +66,14 @@ impl SysStats {
|
||||
pub fn format_header<W: Write>(w: &mut W) -> Result<()> {
|
||||
writeln!(
|
||||
w,
|
||||
"\x1b[93m| {:8} | {:9} | {:9} | {:8} | {:8} | {:8} | {:8} | {:8} | {:8} | {:11} | {:12} | {:12} | {:12} |\x1b[0m",
|
||||
"\x1b[93m| {:8} | {:9} | {:9} | {:8} | {:8} | {:8} | {:8} | {:8} | {:8} | {:8} | {:11} | {:12} | {:12} | {:12} |\x1b[0m",
|
||||
"MSEQ",
|
||||
"# Q TASK",
|
||||
"# ACT CPU",
|
||||
"# SCHED",
|
||||
"PERF-CR%",
|
||||
"LAT-CR%",
|
||||
"X-MIG%",
|
||||
"BIG%",
|
||||
"PC/BIG%",
|
||||
"LC/BIG%",
|
||||
@ -88,13 +92,14 @@ impl SysStats {
|
||||
|
||||
writeln!(
|
||||
w,
|
||||
"| {:8} | {:9} | {:9} | {:8} | {:8} | {:8} | {:8} | {:8} | {:8} | {:11} | {:12} | {:12} | {:12} |",
|
||||
"| {:8} | {:9} | {:9} | {:8} | {:8} | {:8} | {:8} | {:8} | {:8} | {:8} | {:11} | {:12} | {:12} | {:12} |",
|
||||
self.mseq,
|
||||
self.nr_queued_task,
|
||||
self.nr_active,
|
||||
self.nr_sched,
|
||||
GPoint(self.pc_pc),
|
||||
GPoint(self.pc_lc),
|
||||
GPoint(self.pc_x_migration),
|
||||
GPoint(self.pc_big),
|
||||
GPoint(self.pc_pc_on_big),
|
||||
GPoint(self.pc_lc_on_big),
|
||||
|
Loading…
Reference in New Issue
Block a user