diff options
author | 2024-06-24 10:51:49 -1000 | |
---|---|---|
committer | 2024-07-08 08:55:46 -1000 | |
commit | 60564acbef5c43eeb11ecadf6efe17ac255a80b1 (patch) | |
tree | 4b0c93d507f4cf852c53692f49eb215df9d83742 /kernel/sched/core.c | |
parent | sched/ext: Add BPF function to fetch rq (diff) | |
download | wireguard-linux-60564acbef5c43eeb11ecadf6efe17ac255a80b1.tar.xz wireguard-linux-60564acbef5c43eeb11ecadf6efe17ac255a80b1.zip |
sched, sched_ext: Simplify dl_prio() case handling in sched_fork()
sched_fork() returns with -EAGAIN if dl_prio(@p). a7a9fc549293 ("sched_ext:
Add boilerplate for extensible scheduler class") added scx_pre_fork() call
before it and then scx_cancel_fork() on the exit path. This is silly as the
dl_prio() block can just be moved above the scx_pre_fork() call.
Move the dl_prio() block above the scx_pre_fork() call and remove the now
unnecessary scx_cancel_fork() invocation.
Signed-off-by: Tejun Heo <tj@kernel.org>
Suggested-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: David Vernet <void@manifault.com>
Diffstat (limited to '')
-rw-r--r-- | kernel/sched/core.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 8feeac2aaf52..7964edbe2ae6 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -4580,8 +4580,6 @@ late_initcall(sched_core_sysctl_init); */ int sched_fork(unsigned long clone_flags, struct task_struct *p) { - int ret; - __sched_fork(clone_flags, p); /* * We mark the process as NEW here. This guarantees that @@ -4618,12 +4616,12 @@ int sched_fork(unsigned long clone_flags, struct task_struct *p) p->sched_reset_on_fork = 0; } + if (dl_prio(p->prio)) + return -EAGAIN; + scx_pre_fork(p); - if (dl_prio(p->prio)) { - ret = -EAGAIN; - goto out_cancel; - } else if (rt_prio(p->prio)) { + if (rt_prio(p->prio)) { p->sched_class = &rt_sched_class; #ifdef CONFIG_SCHED_CLASS_EXT } else if (task_should_scx(p)) { @@ -4649,10 +4647,6 @@ int sched_fork(unsigned long clone_flags, struct task_struct *p) RB_CLEAR_NODE(&p->pushable_dl_tasks); #endif return 0; - -out_cancel: - scx_cancel_fork(p); - return ret; } int sched_cgroup_fork(struct task_struct *p, struct kernel_clone_args *kargs) |