diff --git a/scheds/c-user/scx_nest.c b/scheds/c-user/scx_nest.c index 3195b6928a..34b26232bb 100644 --- a/scheds/c-user/scx_nest.c +++ b/scheds/c-user/scx_nest.c @@ -6,6 +6,7 @@ */ #include #include +#include #include #include #include @@ -143,7 +144,7 @@ static void print_active_nests(const struct scx_nest *skel) total++; } } - printf("%-9s(%2lu): | %s |\n", mask_str, total, cpus); + printf("%-9s(%2" PRIu64 "): | %s |\n", mask_str, total, cpus); } } @@ -209,7 +210,7 @@ int main(int argc, char **argv) print_stat_grp(nest_stat->group); last_grp = nest_stat->group; } - printf("%s=%lu\n", nest_stat->label, stats[nest_stat->idx]); + printf("%s=%" PRIu64 "\n", nest_stat->label, stats[nest_stat->idx]); } printf("\n"); print_active_nests(skel); diff --git a/scheds/kernel-examples/scx_central.c b/scheds/kernel-examples/scx_central.c index a3d22409e9..501505001b 100644 --- a/scheds/kernel-examples/scx_central.c +++ b/scheds/kernel-examples/scx_central.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -103,17 +104,17 @@ int main(int argc, char **argv) while (!exit_req && !uei_exited(&skel->bss->uei)) { printf("[SEQ %llu]\n", seq++); - printf("total :%10lu local:%10lu queued:%10lu lost:%10lu\n", + printf("total :%10" PRIu64 " local:%10" PRIu64 " queued:%10" PRIu64 " lost:%10" PRIu64 "\n", skel->bss->nr_total, skel->bss->nr_locals, skel->bss->nr_queued, skel->bss->nr_lost_pids); - printf("timer :%10lu dispatch:%10lu mismatch:%10lu retry:%10lu\n", + printf("timer :%10" PRIu64 " dispatch:%10" PRIu64 " mismatch:%10" PRIu64 " retry:%10" PRIu64 "\n", skel->bss->nr_timers, skel->bss->nr_dispatches, skel->bss->nr_mismatches, skel->bss->nr_retries); - printf("overflow:%10lu\n", + printf("overflow:%10" PRIu64 "\n", skel->bss->nr_overflows); fflush(stdout); sleep(1); diff --git a/scheds/kernel-examples/scx_flatcg.bpf.c b/scheds/kernel-examples/scx_flatcg.bpf.c index 84a60d7e40..9926cbd3ea 100644 --- a/scheds/kernel-examples/scx_flatcg.bpf.c +++ b/scheds/kernel-examples/scx_flatcg.bpf.c @@ -123,7 +123,7 @@ struct { } task_ctx SEC(".maps"); /* gets inc'd on weight tree changes to expire the cached hweights */ -unsigned long hweight_gen = 1; +u64 hweight_gen = 1; static u64 div_round_up(u64 dividend, u64 divisor) { diff --git a/scheds/kernel-examples/scx_flatcg.c b/scheds/kernel-examples/scx_flatcg.c index 6a6e47c83e..99e719cd2c 100644 --- a/scheds/kernel-examples/scx_flatcg.c +++ b/scheds/kernel-examples/scx_flatcg.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -183,7 +184,7 @@ int main(int argc, char **argv) memcpy(last_stats, acc_stats, sizeof(acc_stats)); - printf("\n[SEQ %6lu cpu=%5.1lf hweight_gen=%lu]\n", + printf("\n[SEQ %6lu cpu=%5.1lf hweight_gen=%" PRIu64 "]\n", seq++, cpu_util * 100.0, skel->data->hweight_gen); printf(" act:%6llu deact:%6llu local:%6llu global:%6llu\n", stats[FCG_STAT_ACT], diff --git a/scheds/kernel-examples/scx_pair.c b/scheds/kernel-examples/scx_pair.c index 693f095b8c..1eb30efeb0 100644 --- a/scheds/kernel-examples/scx_pair.c +++ b/scheds/kernel-examples/scx_pair.c @@ -6,6 +6,7 @@ */ #include #include +#include #include #include #include @@ -142,18 +143,18 @@ int main(int argc, char **argv) while (!exit_req && !uei_exited(&skel->bss->uei)) { printf("[SEQ %llu]\n", seq++); - printf(" total:%10lu dispatch:%10lu missing:%10lu\n", + printf(" total:%10" PRIu64 " dispatch:%10" PRIu64 " missing:%10" PRIu64 "\n", skel->bss->nr_total, skel->bss->nr_dispatched, skel->bss->nr_missing); - printf(" kicks:%10lu preemptions:%7lu\n", + printf(" kicks:%10" PRIu64 " preemptions:%7" PRIu64 "\n", skel->bss->nr_kicks, skel->bss->nr_preemptions); - printf(" exp:%10lu exp_wait:%10lu exp_empty:%10lu\n", + printf(" exp:%10" PRIu64 " exp_wait:%10" PRIu64 " exp_empty:%10" PRIu64 "\n", skel->bss->nr_exps, skel->bss->nr_exp_waits, skel->bss->nr_exp_empty); - printf("cgnext:%10lu cgcoll:%10lu cgempty:%10lu\n", + printf("cgnext:%10" PRIu64 " cgcoll:%10" PRIu64 " cgempty:%10" PRIu64 "\n", skel->bss->nr_cgrp_next, skel->bss->nr_cgrp_coll, skel->bss->nr_cgrp_empty); diff --git a/scheds/kernel-examples/scx_qmap.bpf.c b/scheds/kernel-examples/scx_qmap.bpf.c index 831df3f644..997a7d3e17 100644 --- a/scheds/kernel-examples/scx_qmap.bpf.c +++ b/scheds/kernel-examples/scx_qmap.bpf.c @@ -95,8 +95,8 @@ struct { } dispatch_idx_cnt SEC(".maps"); /* Statistics */ -unsigned long nr_enqueued, nr_dispatched, nr_reenqueued, nr_dequeued; -unsigned long nr_core_sched_execed; +u64 nr_enqueued, nr_dispatched, nr_reenqueued, nr_dequeued; +u64 nr_core_sched_execed; s32 BPF_STRUCT_OPS(qmap_select_cpu, struct task_struct *p, s32 prev_cpu, u64 wake_flags) diff --git a/scheds/kernel-examples/scx_qmap.c b/scheds/kernel-examples/scx_qmap.c index d817115c0b..7008b91386 100644 --- a/scheds/kernel-examples/scx_qmap.c +++ b/scheds/kernel-examples/scx_qmap.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -90,7 +91,7 @@ int main(int argc, char **argv) long nr_enqueued = skel->bss->nr_enqueued; long nr_dispatched = skel->bss->nr_dispatched; - printf("enq=%lu, dsp=%lu, delta=%ld, reenq=%lu, deq=%lu, core=%lu\n", + printf("enq=%lu, dsp=%lu, delta=%ld, reenq=%" PRIu64 ", deq=%" PRIu64 ", core=%" PRIu64 "\n", nr_enqueued, nr_dispatched, nr_enqueued - nr_dispatched, skel->bss->nr_reenqueued, skel->bss->nr_dequeued, skel->bss->nr_core_sched_execed); diff --git a/scheds/kernel-examples/scx_userland.bpf.c b/scheds/kernel-examples/scx_userland.bpf.c index f2791a6aec..a48a7dde67 100644 --- a/scheds/kernel-examples/scx_userland.bpf.c +++ b/scheds/kernel-examples/scx_userland.bpf.c @@ -20,7 +20,6 @@ * Copyright (c) 2022 Tejun Heo * Copyright (c) 2022 David Vernet */ -#include #include #include "scx_userland.h" @@ -146,9 +145,8 @@ static void dispatch_user_scheduler(void) static void enqueue_task_in_user_space(struct task_struct *p, u64 enq_flags) { - struct scx_userland_enqueued_task task; + struct scx_userland_enqueued_task task = {}; - memset(&task, 0, sizeof(task)); task.pid = p->pid; task.sum_exec_runtime = p->se.sum_exec_runtime; task.weight = p->scx.weight;