Skip to content
This repository has been archived by the owner on Jun 18, 2024. It is now read-only.

Commit

Permalink
Merge pull request #152 from sched-ext/htejun
Browse files Browse the repository at this point in the history
scx: Ignore WF_EXEC
  • Loading branch information
htejun authored Mar 5, 2024
2 parents 047f5c2 + 0f28bed commit 6e7c0d4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
17 changes: 15 additions & 2 deletions kernel/sched/ext.c
Original file line number Diff line number Diff line change
Expand Up @@ -2154,6 +2154,19 @@ __bpf_kfunc_end_defs();

static int select_task_rq_scx(struct task_struct *p, int prev_cpu, int wake_flags)
{
/*
* sched_exec() calls with %WF_EXEC when @p is about to exec(2) as it
* can be a good migration opportunity with low cache and memory
* footprint. Returning a CPU different than @prev_cpu triggers
* immediate rq migration. However, for SCX, as the current rq
* association doesn't dictate where the task is going to run, this
* doesn't fit well. If necessary, we can later add a dedicated method
* which can decide to preempt self to force it through the regular
* scheduling path.
*/
if (unlikely(wake_flags & WF_EXEC))
return prev_cpu;

if (SCX_HAS_OP(select_cpu)) {
s32 cpu;
struct task_struct **ddsp_taskp;
Expand Down Expand Up @@ -4433,8 +4446,8 @@ void __init init_sched_ext_class(void)
* definitions so that BPF scheduler implementations can use them
* through the generated vmlinux.h.
*/
WRITE_ONCE(v, SCX_WAKE_EXEC | SCX_ENQ_WAKEUP | SCX_DEQ_SLEEP |
SCX_TG_ONLINE | SCX_KICK_PREEMPT);
WRITE_ONCE(v, SCX_ENQ_WAKEUP | SCX_DEQ_SLEEP | SCX_TG_ONLINE |
SCX_KICK_PREEMPT);

BUG_ON(rhashtable_init(&dsq_hash, &dsq_hash_params));
init_dsq(&scx_dsq_global, SCX_DSQ_GLOBAL);
Expand Down
1 change: 0 additions & 1 deletion kernel/sched/ext.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
*/
enum scx_wake_flags {
/* expose select WF_* flags as enums */
SCX_WAKE_EXEC = WF_EXEC,
SCX_WAKE_FORK = WF_FORK,
SCX_WAKE_TTWU = WF_TTWU,
SCX_WAKE_SYNC = WF_SYNC,
Expand Down

0 comments on commit 6e7c0d4

Please sign in to comment.