Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1620496

Re: [PATCH v2] sched/fair: update scale invariance of PELT

From Peter Zijlstra <peterz@infradead.org>
Newsgroups linux.kernel
Subject Re: [PATCH v2] sched/fair: update scale invariance of PELT
Date 2017-04-10 19:40 +0200
Message-ID <tuLsf-3QQ-69@gated-at.bofh.it> (permalink)
References <tuDEl-7d7-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Thanks for the rebase.

On Mon, Apr 10, 2017 at 11:18:29AM +0200, Vincent Guittot wrote:

Ok, so let me try and paraphrase what this patch does.

So consider a task that runs 16 out of our 32ms window:

   running   idle
  |---------|---------|


You're saying that when we scale running with the frequency, suppose we
were at 50% freq, we'll end up with:

   run  idle
  |----|---------|


Which is obviously a shorter total then before; so what you do is add
back the lost idle time like:

   run  lost idle
  |----|----|---------|


to arrive at the same total time. Which seems to make sense.

Now I have vague memories of Morten having issues with your previous
patches, so I'll wait for him to chime in as well.


On to the implementation:

>  /*
> + * Scale the time to reflect the effective amount of computation done during
> + * this delta time.
> + */
> +static __always_inline u64
> +scale_time(u64 delta, int cpu, struct sched_avg *sa,
> +		unsigned long weight, int running)
> +{
> +	if (running) {
> +		sa->stolen_idle_time += delta;
> +		/*
> +		 * scale the elapsed time to reflect the real amount of
> +		 * computation
> +		 */
> +		delta = cap_scale(delta, arch_scale_freq_capacity(NULL, cpu));
> +		delta = cap_scale(delta, arch_scale_cpu_capacity(NULL, cpu));
> +
> +		/*
> +		 * Track the amount of stolen idle time due to running at
> +		 * lower capacity
> +		 */
> +		sa->stolen_idle_time -= delta;

OK so far so good, this tracks, in stolen_idle_time, the 'lost' bit from
above.

> +	} else if (!weight) {
> +		if (sa->util_sum < (LOAD_AVG_MAX * 1000)) {

But here I'm completely lost. WTF just happened ;-)

Firstly, I think we want a comment on why we care about the !weight
case. Why isn't !running sufficient?

Secondly, what's up with the util_sum < LOAD_AVG_MAX * 1000 thing?

Is that to deal with cpu_capacity?


> +			/*
> +			 * Add the idle time stolen by running at lower compute
> +			 * capacity
> +			 */
> +			delta += sa->stolen_idle_time;
> +		}
> +		sa->stolen_idle_time = 0;
> +	}
> +
> +	return delta;
> +}


Thirdly, I'm thinking this isn't quite right. Imagine a task that's
running across a decay window, then we'll only add back the stolen_idle
time in the next window, even though it should've been in this one,
right?

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2] sched/fair: update scale invariance of PELT Vincent Guittot <vincent.guittot@linaro.org> - 2017-04-10 11:20 +0200
  Re: [PATCH v2] sched/fair: update scale invariance of PELT Peter Zijlstra <peterz@infradead.org> - 2017-04-10 19:40 +0200
    Re: [PATCH v2] sched/fair: update scale invariance of PELT Vincent Guittot <vincent.guittot@linaro.org> - 2017-04-11 10:00 +0200
      Re: [PATCH v2] sched/fair: update scale invariance of PELT Peter Zijlstra <peterz@infradead.org> - 2017-04-11 11:00 +0200
        Re: [PATCH v2] sched/fair: update scale invariance of PELT Vincent Guittot <vincent.guittot@linaro.org> - 2017-04-11 11:50 +0200
          Re: [PATCH v2] sched/fair: update scale invariance of PELT Peter Zijlstra <peterz@infradead.org> - 2017-04-11 12:50 +0200
            Re: [PATCH v2] sched/fair: update scale invariance of PELT Peter Zijlstra <peterz@infradead.org> - 2017-04-11 13:00 +0200
              Re: [PATCH v2] sched/fair: update scale invariance of PELT Vincent Guittot <vincent.guittot@linaro.org> - 2017-04-11 15:10 +0200
                Re: [PATCH v2] sched/fair: update scale invariance of PELT Peter Zijlstra <peterz@infradead.org> - 2017-04-12 13:30 +0200
                Re: [PATCH v2] sched/fair: update scale invariance of PELT Vincent Guittot <vincent.guittot@linaro.org> - 2017-04-12 17:00 +0200
                Re: [PATCH v2] sched/fair: update scale invariance of PELT Peter Zijlstra <peterz@infradead.org> - 2017-04-12 17:50 +0200
                Re: [PATCH v2] sched/fair: update scale invariance of PELT Vincent Guittot <vincent.guittot@linaro.org> - 2017-04-13 11:50 +0200
                Re: [PATCH v2] sched/fair: update scale invariance of PELT Peter Zijlstra <peterz@infradead.org> - 2017-04-13 15:40 +0200
                Re: [PATCH v2] sched/fair: update scale invariance of PELT Vincent Guittot <vincent.guittot@linaro.org> - 2017-04-13 17:00 +0200
                Re: [PATCH v2] sched/fair: update scale invariance of PELT Peter Zijlstra <peterz@infradead.org> - 2017-04-13 20:10 +0200
                Re: [PATCH v2] sched/fair: update scale invariance of PELT Vincent Guittot <vincent.guittot@linaro.org> - 2017-04-14 10:50 +0200
            Re: [PATCH v2] sched/fair: update scale invariance of PELT Vincent Guittot <vincent.guittot@linaro.org> - 2017-04-11 14:10 +0200
      Re: [PATCH v2] sched/fair: update scale invariance of PELT Peter Zijlstra <peterz@infradead.org> - 2017-04-11 11:20 +0200
        Re: [PATCH v2] sched/fair: update scale invariance of PELT Vincent Guittot <vincent.guittot@linaro.org> - 2017-04-11 11:50 +0200
      Re: [PATCH v2] sched/fair: update scale invariance of PELT Peter Zijlstra <peterz@infradead.org> - 2017-04-13 15:40 +0200
        Re: [PATCH v2] sched/fair: update scale invariance of PELT Vincent Guittot <vincent.guittot@linaro.org> - 2017-04-13 17:20 +0200
          Re: [PATCH v2] sched/fair: update scale invariance of PELT Peter Zijlstra <peterz@infradead.org> - 2017-04-13 18:20 +0200
            Re: [PATCH v2] sched/fair: update scale invariance of PELT Vincent Guittot <vincent.guittot@linaro.org> - 2017-04-14 11:00 +0200
              Re: [PATCH v2] sched/fair: update scale invariance of PELT Vincent Guittot <vincent.guittot@linaro.org> - 2017-04-19 18:40 +0200

csiph-web