Skip to content

Commit

Permalink
Fix scheduler disengagement in rusty
Browse files Browse the repository at this point in the history
Have rusty not error when pids are missing
  • Loading branch information
likewhatevs committed Oct 2, 2024
1 parent 073984f commit 2d78731
Showing 1 changed file with 15 additions and 18 deletions.
33 changes: 15 additions & 18 deletions scheds/rust/scx_rusty/src/bpf/main.bpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -402,26 +402,23 @@ int dom_xfer_task(pid_t pid, u32 new_dom_id, u64 now)
struct dom_ctx *from_domc, *to_domc;
struct task_ctx *taskc;
struct task_struct *p;

p = bpf_task_from_pid(pid);
if (!p) {
scx_bpf_error("Failed to lookup task %d", pid);
return 0;
if (p) {
taskc = try_lookup_task_ctx(p);
if(taskc){
from_domc = lookup_dom_ctx(taskc->dom_id);
to_domc = lookup_dom_ctx(new_dom_id);

if (from_domc && to_domc && taskc){
dom_dcycle_xfer_task(p, taskc, from_domc, to_domc, now);
}
} else {
bpf_printk("Failed to lookup task ctx %d", pid);
}
bpf_task_release(p);
} else {
bpf_printk("Failed to lookup task %d", pid);
}

taskc = lookup_task_ctx(p);
if (!taskc)
goto free_task;

from_domc = lookup_dom_ctx(taskc->dom_id);
to_domc = lookup_dom_ctx(new_dom_id);

if (!from_domc || !to_domc || !taskc)
goto free_task;

dom_dcycle_xfer_task(p, taskc, from_domc, to_domc, now);
free_task:
bpf_task_release(p);
return 0;
}

Expand Down

0 comments on commit 2d78731

Please sign in to comment.