Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions scheds/rust/scx_lavd/src/bpf/main.bpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -783,15 +783,29 @@ void BPF_STRUCT_OPS(lavd_runnable, struct task_struct *p, u64 enq_flags)
/*
* When a task @p is wakened up, the wake frequency of its waker task
* is updated. The @current task is a waker and @p is a waiter, which
* is being wakened up now.
* is being wakened up now. This is true only when
* SCX_OPS_ALLOW_QUEUED_WAKEUP is not set. The wake-up operations are
* batch processed with SCX_OPS_ALLOW_QUEUED_WAKEUP, so @current task
* is no longer a waker task.
*/
if (!(enq_flags & SCX_ENQ_WAKEUP))
return;

/*
* Filter out unrelated tasks.
* Filter out unrelated tasks. We keep track of userspace tasks under
* the same parent process to confine the waker-wakee relationship
* within closely related tasks.
*/
if (enq_flags & (SCX_ENQ_PREEMPT | SCX_ENQ_REENQ | SCX_ENQ_LAST))
return;

if (is_kernel_task(p))
return;

waker = bpf_get_current_task_btf();
if ((p->real_parent != waker->real_parent) || is_kernel_task(waker))
return;

waker_taskc = get_task_ctx(waker);
if (!waker_taskc) {
/*
Expand Down
3 changes: 1 addition & 2 deletions scheds/rust/scx_lavd/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -509,8 +509,7 @@ impl<'a> Scheduler<'a> {
skel.maps.rodata_data.preempt_shift = opts.preempt_shift;
skel.maps.rodata_data.no_use_em = opts.no_use_em as u8;

skel.struct_ops.lavd_ops_mut().flags = *compat::SCX_OPS_ALLOW_QUEUED_WAKEUP
| *compat::SCX_OPS_ENQ_EXITING
skel.struct_ops.lavd_ops_mut().flags = *compat::SCX_OPS_ENQ_EXITING
| *compat::SCX_OPS_ENQ_LAST
| *compat::SCX_OPS_ENQ_MIGRATION_DISABLED
| *compat::SCX_OPS_KEEP_BUILTIN_IDLE;
Expand Down