Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions scheds/c-user/scx_nest.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*/
#include <stdio.h>
#include <unistd.h>
#include <inttypes.h>
#include <signal.h>
#include <libgen.h>
#include <bpf/bpf.h>
Expand Down Expand Up @@ -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);
}
}

Expand Down Expand Up @@ -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);
Expand Down
7 changes: 4 additions & 3 deletions scheds/kernel-examples/scx_central.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <sched.h>
#include <stdio.h>
#include <unistd.h>
#include <inttypes.h>
#include <signal.h>
#include <libgen.h>
#include <bpf/bpf.h>
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion scheds/kernel-examples/scx_flatcg.bpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
3 changes: 2 additions & 1 deletion scheds/kernel-examples/scx_flatcg.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <unistd.h>
#include <libgen.h>
#include <limits.h>
#include <inttypes.h>
#include <fcntl.h>
#include <time.h>
#include <bpf/bpf.h>
Expand Down Expand Up @@ -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],
Expand Down
9 changes: 5 additions & 4 deletions scheds/kernel-examples/scx_pair.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*/
#include <stdio.h>
#include <unistd.h>
#include <inttypes.h>
#include <signal.h>
#include <libgen.h>
#include <bpf/bpf.h>
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions scheds/kernel-examples/scx_qmap.bpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion scheds/kernel-examples/scx_qmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <inttypes.h>
#include <signal.h>
#include <libgen.h>
#include <bpf/bpf.h>
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 1 addition & 3 deletions scheds/kernel-examples/scx_userland.bpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
* Copyright (c) 2022 Tejun Heo <tj@kernel.org>
* Copyright (c) 2022 David Vernet <dvernet@meta.com>
*/
#include <string.h>
#include <scx/common.bpf.h>
#include "scx_userland.h"

Expand Down Expand Up @@ -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;
Expand Down