Skip to content

Commit 038730d

Browse files
Changwoo Minhtejun
authored andcommitted
sched_ext: Change the event type from u64 to s64
The event count could be negative in the future, so change the event type from u64 to s64. Signed-off-by: Changwoo Min <[email protected]> Signed-off-by: Tejun Heo <[email protected]>
1 parent 8a9b158 commit 038730d

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

kernel/sched/ext.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1489,53 +1489,53 @@ struct scx_event_stats {
14891489
* If ops.select_cpu() returns a CPU which can't be used by the task,
14901490
* the core scheduler code silently picks a fallback CPU.
14911491
*/
1492-
u64 SCX_EV_SELECT_CPU_FALLBACK;
1492+
s64 SCX_EV_SELECT_CPU_FALLBACK;
14931493

14941494
/*
14951495
* When dispatching to a local DSQ, the CPU may have gone offline in
14961496
* the meantime. In this case, the task is bounced to the global DSQ.
14971497
*/
1498-
u64 SCX_EV_DISPATCH_LOCAL_DSQ_OFFLINE;
1498+
s64 SCX_EV_DISPATCH_LOCAL_DSQ_OFFLINE;
14991499

15001500
/*
15011501
* If SCX_OPS_ENQ_LAST is not set, the number of times that a task
15021502
* continued to run because there were no other tasks on the CPU.
15031503
*/
1504-
u64 SCX_EV_DISPATCH_KEEP_LAST;
1504+
s64 SCX_EV_DISPATCH_KEEP_LAST;
15051505

15061506
/*
15071507
* If SCX_OPS_ENQ_EXITING is not set, the number of times that a task
15081508
* is dispatched to a local DSQ when exiting.
15091509
*/
1510-
u64 SCX_EV_ENQ_SKIP_EXITING;
1510+
s64 SCX_EV_ENQ_SKIP_EXITING;
15111511

15121512
/*
15131513
* If SCX_OPS_ENQ_MIGRATION_DISABLED is not set, the number of times a
15141514
* migration disabled task skips ops.enqueue() and is dispatched to its
15151515
* local DSQ.
15161516
*/
1517-
u64 SCX_EV_ENQ_SKIP_MIGRATION_DISABLED;
1517+
s64 SCX_EV_ENQ_SKIP_MIGRATION_DISABLED;
15181518

15191519
/*
15201520
* The total number of tasks enqueued (or pick_task-ed) with a
15211521
* default time slice (SCX_SLICE_DFL).
15221522
*/
1523-
u64 SCX_EV_ENQ_SLICE_DFL;
1523+
s64 SCX_EV_ENQ_SLICE_DFL;
15241524

15251525
/*
15261526
* The total duration of bypass modes in nanoseconds.
15271527
*/
1528-
u64 SCX_EV_BYPASS_DURATION;
1528+
s64 SCX_EV_BYPASS_DURATION;
15291529

15301530
/*
15311531
* The number of tasks dispatched in the bypassing mode.
15321532
*/
1533-
u64 SCX_EV_BYPASS_DISPATCH;
1533+
s64 SCX_EV_BYPASS_DISPATCH;
15341534

15351535
/*
15361536
* The number of times the bypassing mode has been activated.
15371537
*/
1538-
u64 SCX_EV_BYPASS_ACTIVATE;
1538+
s64 SCX_EV_BYPASS_ACTIVATE;
15391539
};
15401540

15411541
/*
@@ -1584,7 +1584,7 @@ static DEFINE_PER_CPU(struct scx_event_stats, event_stats_cpu);
15841584
* @kind: a kind of event to dump
15851585
*/
15861586
#define scx_dump_event(s, events, kind) do { \
1587-
dump_line(&(s), "%40s: %16llu", #kind, (events)->kind); \
1587+
dump_line(&(s), "%40s: %16lld", #kind, (events)->kind); \
15881588
} while (0)
15891589

15901590

tools/sched_ext/scx_qmap.bpf.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -776,21 +776,21 @@ static int monitor_timerfn(void *map, int *key, struct bpf_timer *timer)
776776

777777
__COMPAT_scx_bpf_events(&events, sizeof(events));
778778

779-
bpf_printk("%35s: %llu", "SCX_EV_SELECT_CPU_FALLBACK",
779+
bpf_printk("%35s: %lld", "SCX_EV_SELECT_CPU_FALLBACK",
780780
scx_read_event(&events, SCX_EV_SELECT_CPU_FALLBACK));
781-
bpf_printk("%35s: %llu", "SCX_EV_DISPATCH_LOCAL_DSQ_OFFLINE",
781+
bpf_printk("%35s: %lld", "SCX_EV_DISPATCH_LOCAL_DSQ_OFFLINE",
782782
scx_read_event(&events, SCX_EV_DISPATCH_LOCAL_DSQ_OFFLINE));
783-
bpf_printk("%35s: %llu", "SCX_EV_DISPATCH_KEEP_LAST",
783+
bpf_printk("%35s: %lld", "SCX_EV_DISPATCH_KEEP_LAST",
784784
scx_read_event(&events, SCX_EV_DISPATCH_KEEP_LAST));
785-
bpf_printk("%35s: %llu", "SCX_EV_ENQ_SKIP_EXITING",
785+
bpf_printk("%35s: %lld", "SCX_EV_ENQ_SKIP_EXITING",
786786
scx_read_event(&events, SCX_EV_ENQ_SKIP_EXITING));
787-
bpf_printk("%35s: %llu", "SCX_EV_ENQ_SLICE_DFL",
787+
bpf_printk("%35s: %lld", "SCX_EV_ENQ_SLICE_DFL",
788788
scx_read_event(&events, SCX_EV_ENQ_SLICE_DFL));
789-
bpf_printk("%35s: %llu", "SCX_EV_BYPASS_DURATION",
789+
bpf_printk("%35s: %lld", "SCX_EV_BYPASS_DURATION",
790790
scx_read_event(&events, SCX_EV_BYPASS_DURATION));
791-
bpf_printk("%35s: %llu", "SCX_EV_BYPASS_DISPATCH",
791+
bpf_printk("%35s: %lld", "SCX_EV_BYPASS_DISPATCH",
792792
scx_read_event(&events, SCX_EV_BYPASS_DISPATCH));
793-
bpf_printk("%35s: %llu", "SCX_EV_BYPASS_ACTIVATE",
793+
bpf_printk("%35s: %lld", "SCX_EV_BYPASS_ACTIVATE",
794794
scx_read_event(&events, SCX_EV_BYPASS_ACTIVATE));
795795

796796
bpf_timer_start(timer, ONE_SEC_IN_NS, 0);

0 commit comments

Comments
 (0)