Re: [RFC PATCH] sched/fair: update the vruntime to be max vruntime when yield

From: Steven Rostedt
Date: Mon Feb 27 2023 - 11:21:13 EST


On Mon, 27 Feb 2023 16:40:33 +0100
Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:

> On Wed, Feb 22, 2023 at 04:03:14PM +0800, Xuewen Yan wrote:
> > When task call the sched_yield, cfs would set the cfs's skip buddy.
> > If there is no other task call the sched_yield syscall, the task would
> > always be skiped when there are tasks in rq.
>
> So you have two tasks A) which does sched_yield() and becomes ->skip,
> and B) which is while(1). And you're saying that once A does it's thing,
> B runs forever and starves A?

If Xuewen has an example program that demonstrates the issue (pinning to a
CPU the two tasks), that could be very useful.

> This is a bad solution, SCHED_IDLE tasks have very low weight and can be
> shot really far to the right, leading to other trouble.

Does SCHED_IDLE tasks have to run on a busy CPU? That is, if you have a
SCHED_OTHER task running in a while loop, a SCHED_IDLE task will still get
runtime on that CPU? I always thought SCHED_IDLE tasks were just background
tasks for running when there was nothing else to run?

-- Steve