Skip to content

Commit c06dbd3

Browse files
committed
scx_tickless: Switch to scx_bpf_remote_curr()
The new scx_bpf_remote_curr() is safer to use, switch to it from scx_bpf_cpu_rq() as we only care about it's ->curr anyway. Signed-off-by: Christian Loehle <[email protected]>
1 parent 05c2e33 commit c06dbd3

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

scheds/rust/scx_tickless/src/bpf/main.bpf.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -414,12 +414,17 @@ static int sched_timerfn(void *map, int *key, struct bpf_timer *timer)
414414
*/
415415
bpf_for(cpu, 0, nr_cpu_ids) {
416416
struct task_struct *p;
417+
bool idle;
417418

418419
/*
419420
* Ignore CPU if idle task is running.
420421
*/
421-
p = scx_bpf_cpu_rq(cpu)->curr;
422-
if (p->flags & PF_IDLE)
422+
p = scx_bpf_remote_curr(cpu);
423+
if (!p)
424+
continue;
425+
idle = p->flags & PF_IDLE;
426+
bpf_task_release(p);
427+
if (idle)
423428
continue;
424429

425430
/*

0 commit comments

Comments
 (0)