scx_bpfland: drop kthread dispatches metric

Dispatching per-CPU kthreads directly is disabled by default, reporting
this metric can generate some confusion (since it is always 0), and even
if local kthread dispatches are enabled, they should be still considered
as regular direct dispatches (there is no difference in practice).

Therefore, merge direct kthread dispatches into direct dispatches and
drop the separate nr_kthread_dispatches metric.

Signed-off-by: Andrea Righi <righi.andrea@gmail.com>
This commit is contained in:
Andrea Righi 2024-07-22 10:19:34 +02:00
parent a5f1d6b595
commit c1d93d2a00
2 changed files with 3 additions and 13 deletions

View File

@ -94,8 +94,7 @@ static u64 starvation_prio_ts;
/*
* Scheduling statistics.
*/
volatile u64 nr_direct_dispatches, nr_kthread_dispatches,
nr_shared_dispatches, nr_prio_dispatches;
volatile u64 nr_direct_dispatches, nr_shared_dispatches, nr_prio_dispatches;
/*
* Amount of currently running tasks.
@ -549,7 +548,7 @@ void BPF_STRUCT_OPS(bpfland_enqueue, struct task_struct *p, u64 enq_flags)
if (local_kthreads && is_kthread(p) && p->nr_cpus_allowed == 1) {
s32 cpu = scx_bpf_task_cpu(p);
if (!dispatch_direct_cpu(p, cpu, enq_flags)) {
__sync_fetch_and_add(&nr_kthread_dispatches, 1);
__sync_fetch_and_add(&nr_direct_dispatches, 1);
return;
}
}

View File

@ -113,7 +113,6 @@ struct Metrics {
nr_interactive: Gauge,
nr_waiting: Gauge,
nvcsw_avg_thresh: Gauge,
nr_kthread_dispatches: Gauge,
nr_direct_dispatches: Gauge,
nr_prio_dispatches: Gauge,
nr_shared_dispatches: Gauge,
@ -134,9 +133,6 @@ impl Metrics {
nvcsw_avg_thresh: gauge!(
"nvcsw_avg_thresh", "info" => "Average of voluntary context switches"
),
nr_kthread_dispatches: gauge!(
"nr_kthread_dispatches", "info" => "Number of kthread direct dispatches"
),
nr_direct_dispatches: gauge!(
"nr_direct_dispatches", "info" => "Number of task direct dispatches"
),
@ -228,7 +224,6 @@ impl<'a> Scheduler<'a> {
let nr_interactive = self.skel.bss().nr_interactive;
let nr_waiting = self.skel.bss().nr_waiting;
let nvcsw_avg_thresh = self.skel.bss().nvcsw_avg_thresh;
let nr_kthread_dispatches = self.skel.bss().nr_kthread_dispatches;
let nr_direct_dispatches = self.skel.bss().nr_direct_dispatches;
let nr_prio_dispatches = self.skel.bss().nr_prio_dispatches;
let nr_shared_dispatches = self.skel.bss().nr_shared_dispatches;
@ -245,9 +240,6 @@ impl<'a> Scheduler<'a> {
.set(nr_waiting as f64);
self.metrics
.nvcsw_avg_thresh.set(nvcsw_avg_thresh as f64);
self.metrics
.nr_kthread_dispatches
.set(nr_kthread_dispatches as f64);
self.metrics
.nr_direct_dispatches
.set(nr_direct_dispatches as f64);
@ -259,13 +251,12 @@ impl<'a> Scheduler<'a> {
.set(nr_shared_dispatches as f64);
// Log scheduling statistics.
info!("running: {:>4}/{:<4} interactive: {:<4} wait: {:<4} | nvcsw: {:<4} | kthread: {:<6} | direct: {:<6} | prio: {:<6} | shared: {:<6}",
info!("running: {:>4}/{:<4} interactive: {:<4} wait: {:<4} | nvcsw: {:<4} | direct: {:<6} prio: {:<6} shared: {:<6}",
nr_running,
nr_cpus,
nr_interactive,
nr_waiting,
nvcsw_avg_thresh,
nr_kthread_dispatches,
nr_direct_dispatches,
nr_prio_dispatches,
nr_shared_dispatches);