[PATCH 2/7] sched_ext: Add an event, SCX_EVENT_OFFLINE_LOCAL_DSQ
From: Changwoo Min
Date: Thu Jan 16 2025 - 10:16:57 EST
Add a core event, SCX_EVENT_OFFLINE_LOCAL_DSQ, which represents how many
times a BPF scheduler tries to dispatch to an offlined local DSQ.
Signed-off-by: Changwoo Min <changwoo@xxxxxxxxxx>
---
kernel/sched/ext.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c
index 7e12d5b8322e..8054e4e5ed0c 100644
--- a/kernel/sched/ext.c
+++ b/kernel/sched/ext.c
@@ -1467,6 +1467,12 @@ struct scx_event_stat {
* the core scheduler code silently picks a fallback CPU.
*/
u64 INVAL_SELECT_CPU;
+
+ /*
+ * When dispatching to a local DSQ, the CPU may have gone offline in
+ * the meantime. In this case, the task is bounced to the global DSQ.
+ */
+ u64 OFFLINE_LOCAL_DSQ;
};
#define SCX_EVENT_IDX(e) (offsetof(struct scx_event_stat, e)/sizeof(u64))
@@ -1479,11 +1485,13 @@ struct scx_event_stat {
enum scx_event_kind {
SCX_EVENT_BEGIN = 0,
SCX_EVENT_DEFINE(INVAL_SELECT_CPU),
+ SCX_EVENT_DEFINE(OFFLINE_LOCAL_DSQ),
SCX_EVENT_END = SCX_EVENT_END_IDX(),
};
static const char *scx_event_stat_str[] = {
[SCX_EVENT_INVAL_SELECT_CPU] = "invalid_select_cpu",
+ [SCX_EVENT_OFFLINE_LOCAL_DSQ] = "offline_local_dsq",
};
/*
@@ -2651,6 +2659,7 @@ static void dispatch_to_local_dsq(struct rq *rq, struct scx_dispatch_q *dst_dsq,
if (unlikely(!task_can_run_on_remote_rq(p, dst_rq, true))) {
dispatch_enqueue(find_global_dsq(p), p,
enq_flags | SCX_ENQ_CLEAR_OPSS);
+ scx_add_event(OFFLINE_LOCAL_DSQ, 1);
return;
}
--
2.48.1