Re: [PATCH v4 sched_ext/for-7.3 07/40] tools/sched_ext: scx_qmap - Use bare u64/u32/s32 integer types
Andrea Righi <[email protected]>
| Newsgroups | dev.linux.lists.sched-ext,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <alAHsY94lkrpAjEA@gpd4> |
On Wed, Jul 08, 2026 at 11:23:56AM -1000, Tejun Heo wrote: > scx_qmap.c and the shared scx_qmap.h mixed __u64/__u32/__s32 with the bare > typedefs that scx/common.h provides. Convert the remaining __-prefixed > integer types to the bare forms for consistency. The struct fields become > bare u64 (uint64_t), so the stats printfs that fed them to %llu now cast to > unsigned long long. No functional change. > > Signed-off-by: Tejun Heo <[email protected]> Reviewed-by: Andrea Righi <[email protected]> Thanks, -Andrea > --- > tools/sched_ext/scx_qmap.c | 21 +++++++++++---------- > tools/sched_ext/scx_qmap.h | 34 +++++++++++++++++----------------- > 2 files changed, 28 insertions(+), 27 deletions(-) > > diff --git a/tools/sched_ext/scx_qmap.c b/tools/sched_ext/scx_qmap.c > index 67ddd483a4c7..f1eaebcab5dc 100644 > --- a/tools/sched_ext/scx_qmap.c > +++ b/tools/sched_ext/scx_qmap.c > @@ -67,8 +67,8 @@ int main(int argc, char **argv) > struct scx_qmap *skel; > struct bpf_link *link; > struct qmap_arena *qa; > - __u32 test_error_cnt = 0; > - __u64 ecode; > + u32 test_error_cnt = 0; > + u64 ecode; > int opt; > > libbpf_set_print(libbpf_print_fn); > @@ -202,15 +202,16 @@ int main(int argc, char **argv) > > printf("stats : enq=%lu dsp=%lu delta=%ld reenq/cid0=%llu/%llu deq=%llu core=%llu enq_ddsp=%llu\n", > nr_enqueued, nr_dispatched, nr_enqueued - nr_dispatched, > - qa->nr_reenqueued, qa->nr_reenqueued_cid0, > - qa->nr_dequeued, > - qa->nr_core_sched_execed, > - qa->nr_ddsp_from_enq); > + (unsigned long long)qa->nr_reenqueued, > + (unsigned long long)qa->nr_reenqueued_cid0, > + (unsigned long long)qa->nr_dequeued, > + (unsigned long long)qa->nr_core_sched_execed, > + (unsigned long long)qa->nr_ddsp_from_enq); > printf(" exp_local=%llu exp_remote=%llu exp_timer=%llu exp_lost=%llu\n", > - qa->nr_expedited_local, > - qa->nr_expedited_remote, > - qa->nr_expedited_from_timer, > - qa->nr_expedited_lost); > + (unsigned long long)qa->nr_expedited_local, > + (unsigned long long)qa->nr_expedited_remote, > + (unsigned long long)qa->nr_expedited_from_timer, > + (unsigned long long)qa->nr_expedited_lost); > if (__COMPAT_has_ksym("scx_bpf_cidperf_cur")) > printf("cpuperf: cur min/avg/max=%u/%u/%u target min/avg/max=%u/%u/%u\n", > qa->cpuperf_min, > diff --git a/tools/sched_ext/scx_qmap.h b/tools/sched_ext/scx_qmap.h > index d15a705d5ac5..808237540f5c 100644 > --- a/tools/sched_ext/scx_qmap.h > +++ b/tools/sched_ext/scx_qmap.h > @@ -28,10 +28,10 @@ > #define SCX_QMAP_MAX_CPUS 1024 > > struct cpu_ctx { > - __u64 dsp_idx; /* dispatch index */ > - __u64 dsp_cnt; /* remaining count */ > - __u32 avg_weight; > - __u32 cpuperf_target; > + u64 dsp_idx; /* dispatch index */ > + u64 dsp_cnt; /* remaining count */ > + u32 avg_weight; > + u32 cpuperf_target; > }; > > /* Opaque to userspace; defined in scx_qmap.bpf.c. */ > @@ -40,25 +40,25 @@ struct task_ctx; > struct qmap_fifo { > struct task_ctx __arena *head; > struct task_ctx __arena *tail; > - __s32 idx; > + s32 idx; > }; > > struct qmap_arena { > /* userspace-visible stats */ > - __u64 nr_enqueued, nr_dispatched, nr_reenqueued, nr_reenqueued_cid0; > - __u64 nr_dequeued, nr_ddsp_from_enq; > - __u64 nr_core_sched_execed; > - __u64 nr_expedited_local, nr_expedited_remote; > - __u64 nr_expedited_lost, nr_expedited_from_timer; > - __u64 nr_highpri_queued; > - __u32 test_error_cnt; > - __u32 cpuperf_min, cpuperf_avg, cpuperf_max; > - __u32 cpuperf_target_min, cpuperf_target_avg, cpuperf_target_max; > + u64 nr_enqueued, nr_dispatched, nr_reenqueued, nr_reenqueued_cid0; > + u64 nr_dequeued, nr_ddsp_from_enq; > + u64 nr_core_sched_execed; > + u64 nr_expedited_local, nr_expedited_remote; > + u64 nr_expedited_lost, nr_expedited_from_timer; > + u64 nr_highpri_queued; > + u32 test_error_cnt; > + u32 cpuperf_min, cpuperf_avg, cpuperf_max; > + u32 cpuperf_target_min, cpuperf_target_avg, cpuperf_target_max; > > /* kernel-side runtime state */ > - __u64 sub_sched_cgroup_ids[MAX_SUB_SCHEDS]; > - __u64 core_sched_head_seqs[5]; > - __u64 core_sched_tail_seqs[5]; > + u64 sub_sched_cgroup_ids[MAX_SUB_SCHEDS]; > + u64 core_sched_head_seqs[5]; > + u64 core_sched_tail_seqs[5]; > > struct cpu_ctx cpu_ctxs[SCX_QMAP_MAX_CPUS]; > > -- > 2.54.0 >