Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

sched_ext: Replace bpf_ktime_get_ns() to scx_bpf_now()

In the BPF schedulers that use bpf_ktime_get_ns() -- scx_central and
scx_flatcg, replace bpf_ktime_get_ns() calls to scx_bpf_now().

Signed-off-by: Changwoo Min <changwoo@igalia.com>
Acked-by: Andrea Righi <arighi@nvidia.com>
Signed-off-by: Tejun Heo <tj@kernel.org>

authored by

Changwoo Min and committed by
Tejun Heo
0f130bc3 d07be814

+3 -3
+2 -2
tools/sched_ext/scx_central.bpf.c
··· 245 245 s32 cpu = scx_bpf_task_cpu(p); 246 246 u64 *started_at = ARRAY_ELEM_PTR(cpu_started_at, cpu, nr_cpu_ids); 247 247 if (started_at) 248 - *started_at = bpf_ktime_get_ns() ?: 1; /* 0 indicates idle */ 248 + *started_at = scx_bpf_now() ?: 1; /* 0 indicates idle */ 249 249 } 250 250 251 251 void BPF_STRUCT_OPS(central_stopping, struct task_struct *p, bool runnable) ··· 258 258 259 259 static int central_timerfn(void *map, int *key, struct bpf_timer *timer) 260 260 { 261 - u64 now = bpf_ktime_get_ns(); 261 + u64 now = scx_bpf_now(); 262 262 u64 nr_to_kick = nr_queued; 263 263 s32 i, curr_cpu; 264 264
+1 -1
tools/sched_ext/scx_flatcg.bpf.c
··· 734 734 struct fcg_cpu_ctx *cpuc; 735 735 struct fcg_cgrp_ctx *cgc; 736 736 struct cgroup *cgrp; 737 - u64 now = bpf_ktime_get_ns(); 737 + u64 now = scx_bpf_now(); 738 738 bool picked_next = false; 739 739 740 740 cpuc = find_cpu_ctx();