Skip to content

Commit

Permalink
Merge pull request #1272 from multics69/lavd-opt-preemption3
Browse files Browse the repository at this point in the history
scx_lavd: Don't try preemption for greedy tasks
  • Loading branch information
multics69 authored Jan 30, 2025
2 parents c7ba8f2 + 8028349 commit ffcd3f0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion scheds/rust/scx_lavd/src/bpf/main.bpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -1068,7 +1068,8 @@ bool can_direct_dispatch(struct task_struct *p, struct task_ctx *taskc,
if (!scx_bpf_dsq_nr_queued(SCX_DSQ_LOCAL_ON | cpu_id))
return true;

if (can_task1_kick_cpu2(taskc, cpuc_task, now)) {
if (is_eligible(taskc) &&
can_task1_kick_cpu2(taskc, cpuc_task, now)) {
*enq_flags |= SCX_ENQ_PREEMPT;
return true;
}
Expand Down
6 changes: 6 additions & 0 deletions scheds/rust/scx_lavd/src/bpf/preempt.bpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,12 @@ static bool try_find_and_kick_victim_cpu(struct task_struct *p,
struct cpu_ctx *victim_cpuc;
bool ret = false;

/*
* Don't even try to perform expensive preemption for greedy tasks.
*/
if (!is_eligible(taskc))
return false;

/*
* Prepare a cpumak so we find a victim in @p's compute domain.
*/
Expand Down

0 comments on commit ffcd3f0

Please sign in to comment.