lkml.org 
[lkml]   [2019]   [Aug]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH 08/15] sched,fair: simplify timeslice length code
On Thu, 29 Aug 2019 at 18:00, Rik van Riel <riel@surriel.com> wrote:
>
> On Thu, 2019-08-29 at 16:02 +0200, Vincent Guittot wrote:
> > On Thu, 29 Aug 2019 at 01:19, Rik van Riel <riel@surriel.com> wrote:
> >
> > > What am I overlooking?
> >
> > My point is more for task that runs several ticks in a row. Their
> > sched_slice will be shorter in some cases with your changes so they
> > can be preempted earlier by other runnable tasks with a lower
> > vruntime
> > and there will be more context switch
>
> I can think of exactly one case where the time slice
> will be shorter with my new code than with the old code,
> and that is the case where:
> - A CPU has nr_running > sched_nr_latency

yes nr_running must be higher than sched_nr_latency

> - __sched_period returns a value larger than sysctl_sched_latency
> - one of the tasks is much higher priority than the others

it's not only one, that can be several. It depends of the number of
running tasks

> - that one task alone gets a timeslice larger than sysctl_sched_latency
>
> With the new code, that high priority task will get a time
> slice that is a (large) fraction of sysctl_sched_latency,

yes

> while the other (lower priority) tasks get their time slices
> rounded up to sysctl_sched_min_granularity.

yes and if the jify period is higher than sysctl_sched_min_granularity
they will get a full jiffy period

>
> When tasks get their timeslice rounded up, that will increase
> the total sched period in a similar way the old code did by
> returning a longer period from __sched_period.

sched_slice is not a strict value and scheduler will not schedule out
the task after the sched_slice (unless you enable HRTICK which is
disable by default). Instead it will wait for next tick to change the
running task

sched_slice is mainly use to ensure a minimum running time in a row.
With this change, the running time of the high priority task will most
probably be split in several slice instead of one

>
> If a CPU is faced with a large number of equal priority tasks,
> both the old code and the new code would end up giving each
> task a timeslice length of sysctl_sched_min_granularity.
>
> What am I missing?
>
> --
> All Rights Reversed.

\
 
 \ /
  Last update: 2019-08-30 08:42    [W:0.242 / U:2.720 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site