-
Notifications
You must be signed in to change notification settings - Fork 32
sched_yield tweaks #35
Description
Some alternative schedulers have " yield_type" tunable
From MuQSS description:
This determines what type of yield calls to sched_yield will perform.
0: No yield.
1: Yield only to better priority/deadline tasks. (default)
2: Expire timeslice and recalculate deadline.
From "Project C" (BMQ/PDS) description:
0 - No yield.
1 - Deboost and requeue task. (default)
2 - Set run queue skip task.
I guess "0" is a questionable value (especially with BMQ where my system with a single core and lowest frequency could stuck) but "1" is fine.
So the question is how to implement it with CFS.
In kernel/sched/core.c there's such part
static void do_sched_yield(void)
{
struct rq_flags rf;
struct rq *rq;
rq = this_rq_lock_irq(&rf);
schedstat_inc(rq->yld_count);
current->sched_class->yield_task(rq);
preempt_disable();
rq_unlock_irq(rq, &rf);
sched_preempt_enable_no_resched();
schedule();
}
With "yield_type=0" MuQSS and PrjC put "return" before "rq = this_rq_lock_irq(&rf);"
static void do_sched_yield(void)
{
struct rq *rq;
struct rq_flags rf;
if (!sched_yield_type)
return;
rq = this_rq_lock_irq(&rf);
But for "current->sched_class->yield_task(rq);" they have their own code which they use for "yield_type=2"
So is it it safe to just comment
current->sched_class->yield_task(rq);
to get something similar to "yield_type=1" for CFS?