mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Luis Machado <luis.machado@arm.com>
To: Peter Zijlstra <peterz@infradead.org>,
	mingo@redhat.com, juri.lelli@redhat.com,
	vincent.guittot@linaro.org, dietmar.eggemann@arm.com,
	rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de,
	bristot@redhat.com, vschneid@redhat.com,
	linux-kernel@vger.kernel.org
Cc: kprateek.nayak@amd.com, wuyun.abel@bytedance.com,
	tglx@linutronix.de, efault@gmx.de, nd <nd@arm.com>,
	John Stultz <jstultz@google.com>,
	Vincent Guittot <vincent.guittot@linaro.org>
Subject: Re: [RFC][PATCH 08/10] sched/fair: Implement delayed dequeue
Date: Wed, 24 Apr 2024 16:15:42 +0100	[thread overview]
Message-ID: <1461277e-af68-41e7-947c-9178b55810b1@arm.com> (raw)
In-Reply-To: <3888d7c8-660e-479c-8c10-8295204e5f36@arm.com>

Hi,

On 4/15/24 18:07, Luis Machado wrote:
> Hi Peter,
> 
> On 4/5/24 11:28, Peter Zijlstra wrote:
>> Extend / fix 86bfbb7ce4f6 ("sched/fair: Add lag based placement") by
>> noting that lag is fundamentally a temporal measure. It should not be
>> carried around indefinitely.
>>
>> OTOH it should also not be instantly discarded, doing so will allow a
>> task to game the system by purposefully (micro) sleeping at the end of
>> its time quantum.
>>
>> Since lag is intimately tied to the virtual time base, a wall-time
>> based decay is also insufficient, notably competition is required for
>> any of this to make sense.
>>
>> Instead, delay the dequeue and keep the 'tasks' on the runqueue,
>> competing until they are eligible.
>>
>> Strictly speaking, we only care about keeping them until the 0-lag
>> point, but that is a difficult proposition, instead carry them around
>> until they get picked again, and dequeue them at that point.
>>
>> Since we should have dequeued them at the 0-lag point, truncate lag
>> (eg. don't let them earn positive lag).
>>
>> XXX test the cfs-throttle stuff
>>
>> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> 
> Playing around with a Pixel 6 running a 6.6-based kernel with this
> series backported on top, I spotted a noticeable performance improvement
> on the speedometer benchmark:
> 
> - m6.6-stock-* is the 6.6 mainline Android kernel unmodified.
> 
> - m6.6-eevdf-complete-* is the 6.6 mainline Android kernel with
> this series applied on top (along with a few required backported
> patches).
> 
> +-------------------+-----------------------+-----------+
> |      metric       |          tag          | perc_diff |
> +-------------------+-----------------------+-----------+
> | Speedometer Score |     m6.6-stock-1      |   0.0%    |
> | Speedometer Score |     m6.6-stock-2      |   1.23%   |
> | Speedometer Score |     m6.6-stock-3      |  -0.22%   |
> | Speedometer Score | m6.6-eevdf-complete-1 |   4.54%   |
> | Speedometer Score | m6.6-eevdf-complete-2 |   4.95%   |
> | Speedometer Score | m6.6-eevdf-complete-3 |   6.07%   |
> +-------------------+-----------------------+-----------+
> 
> Also some interesting improvements in terms of frame timing for the
> uibenchjanktests benchmark. In particular the metrics of missed
> deadlines and jank (late) frames, which seems to indicate better
> latencies.
> 
> +-----------------------+-----------------------+-----------+
> |        metric         |          tag          | perc_diff |
> +-----------------------+-----------------------+-----------+
> | gfx-avg-frame-time-50 |     m6.6-stock-1      |    0.0    |
> | gfx-avg-frame-time-90 |     m6.6-stock-1      |    0.0    |
> | gfx-avg-frame-time-95 |     m6.6-stock-1      |    0.0    |
> | gfx-avg-frame-time-99 |     m6.6-stock-1      |    0.0    |
> | gfx-avg-frame-time-50 |     m6.6-stock-2      |   3.46    |
> | gfx-avg-frame-time-90 |     m6.6-stock-2      |   1.19    |
> | gfx-avg-frame-time-95 |     m6.6-stock-2      |   0.24    |
> | gfx-avg-frame-time-99 |     m6.6-stock-2      |   0.48    |
> | gfx-avg-frame-time-50 | m6.6-eevdf-complete-1 |  -30.45   |
> | gfx-avg-frame-time-90 | m6.6-eevdf-complete-1 |  -48.44   |
> | gfx-avg-frame-time-95 | m6.6-eevdf-complete-1 |  -51.32   |
> | gfx-avg-frame-time-99 | m6.6-eevdf-complete-1 |  -52.48   |
> | gfx-avg-frame-time-50 | m6.6-eevdf-complete-2 |  -30.32   |
> | gfx-avg-frame-time-90 | m6.6-eevdf-complete-2 |  -48.16   |
> | gfx-avg-frame-time-95 | m6.6-eevdf-complete-2 |  -51.08   |
> | gfx-avg-frame-time-99 | m6.6-eevdf-complete-2 |   -51.7   |
> +-----------------------+-----------------------+-----------+
> 
> +-----------------------------------+-----------------------+-----------+
> |              metric               |          tag          | perc_diff |
> +-----------------------------------+-----------------------+-----------+
> | gfx-avg-num-frame-deadline-missed |     m6.6-stock-1      |    0.0    |
> | gfx-max-num-frame-deadline-missed |     m6.6-stock-1      |    0.0    |
> | gfx-avg-num-frame-deadline-missed |     m6.6-stock-2      |   -3.21   |
> | gfx-max-num-frame-deadline-missed |     m6.6-stock-2      |   -3.21   |
> | gfx-avg-num-frame-deadline-missed | m6.6-eevdf-complete-1 |  -85.29   |
> | gfx-max-num-frame-deadline-missed | m6.6-eevdf-complete-1 |  -85.29   |
> | gfx-avg-num-frame-deadline-missed | m6.6-eevdf-complete-2 |   -84.8   |
> | gfx-max-num-frame-deadline-missed | m6.6-eevdf-complete-2 |   -84.8   |
> +-----------------------------------+-----------------------+-----------+
> 
> +----------------------------+-----------------------+-----------+
> |           metric           |          tag          | perc_diff |
> +----------------------------+-----------------------+-----------+
> | gfx-avg-high-input-latency |     m6.6-stock-1      |    0.0    |
> | gfx-max-high-input-latency |     m6.6-stock-1      |    0.0    |
> | gfx-avg-high-input-latency |     m6.6-stock-2      |   0.93    |
> | gfx-max-high-input-latency |     m6.6-stock-2      |   0.93    |
> | gfx-avg-high-input-latency | m6.6-eevdf-complete-1 |  -18.35   |
> | gfx-max-high-input-latency | m6.6-eevdf-complete-1 |  -18.35   |
> | gfx-avg-high-input-latency | m6.6-eevdf-complete-2 |  -18.05   |
> | gfx-max-high-input-latency | m6.6-eevdf-complete-2 |  -18.05   |
> +----------------------------+-----------------------+-----------+
> 
> +--------------+-----------------------+-----------+
> |    metric    |          tag          | perc_diff |
> +--------------+-----------------------+-----------+
> | gfx-avg-jank |     m6.6-stock-1      |    0.0    |
> | gfx-max-jank |     m6.6-stock-1      |    0.0    |
> | gfx-avg-jank |     m6.6-stock-2      |   1.56    |
> | gfx-max-jank |     m6.6-stock-2      |   1.56    |
> | gfx-avg-jank | m6.6-eevdf-complete-1 |  -82.81   |
> | gfx-max-jank | m6.6-eevdf-complete-1 |  -82.81   |
> | gfx-avg-jank | m6.6-eevdf-complete-2 |  -78.12   |
> | gfx-max-jank | m6.6-eevdf-complete-2 |  -78.12   |
> +--------------+-----------------------+-----------+
> 
> Bisecting through the patches in this series, I ended up with patch 08/10
> as the one that improved things overall for these benchmarks.
> 
> I'd like to investigate this further to understand the reason behind some of
> these dramatic improvements.
> 

Investigating these improvements a bit more, I noticed they came with a significantly
higher power usage on the Pixel6 (where EAS is enabled). I bisected it down to the delayed
dequeue patch. Disabling DELAY_DEQUEUE and DELAY_ZERO at runtime doesn't help in bringing
the power usage down.

Though I don't fully understand the reason behind this change in behavior yet, I did spot
the benchmark processes running almost entirely on the big core cluster, with little
to no use of the little core and mid core clusters.

That would explain higher power usage and also the significant jump in performance.

I wonder if the delayed dequeue logic is having an unwanted effect on the calculation of
utilization/load of the runqueue and, as a consequence, we're scheduling things to run on
higher OPP's in the big cores, leading to poor decisions for energy efficiency.



  reply	other threads:[~2024-04-24 15:16 UTC|newest]

Thread overview: 77+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-05 10:27 [RFC][PATCH 00/10] sched/fair: Complete EEVDF Peter Zijlstra
2024-04-05 10:27 ` [RFC][PATCH 01/10] sched/eevdf: Add feature comments Peter Zijlstra
2024-04-05 10:27 ` [RFC][PATCH 02/10] sched/eevdf: Remove min_vruntime_copy Peter Zijlstra
2024-04-05 10:27 ` [RFC][PATCH 03/10] sched/fair: Cleanup pick_task_fair() vs throttle Peter Zijlstra
2024-04-05 21:11   ` Benjamin Segall
2024-04-05 10:27 ` [RFC][PATCH 04/10] sched/fair: Cleanup pick_task_fair()s curr Peter Zijlstra
2024-04-05 10:27 ` [RFC][PATCH 05/10] sched/fair: Unify pick_{,next_}_task_fair() Peter Zijlstra
2024-04-06  2:20   ` Mike Galbraith
2024-04-05 10:28 ` [RFC][PATCH 06/10] sched: Allow sched_class::dequeue_task() to fail Peter Zijlstra
2024-04-05 10:28 ` [RFC][PATCH 07/10] sched/fair: Re-organize dequeue_task_fair() Peter Zijlstra
2024-04-05 10:28 ` [RFC][PATCH 08/10] sched/fair: Implement delayed dequeue Peter Zijlstra
2024-04-06  9:23   ` Chen Yu
2024-04-08  9:06     ` Peter Zijlstra
2024-04-11  1:32       ` Yan-Jie Wang
2024-04-25 10:25         ` Peter Zijlstra
2024-04-12 10:42   ` K Prateek Nayak
2024-04-15 10:56     ` Mike Galbraith
2024-04-16  3:18       ` K Prateek Nayak
2024-04-16  5:36         ` Mike Galbraith
2024-04-18 16:24           ` Mike Galbraith
2024-04-18 17:08             ` K Prateek Nayak
2024-04-24 15:20             ` Peter Zijlstra
2024-04-25 11:28             ` Peter Zijlstra
2024-04-26 10:56               ` Peter Zijlstra
2024-04-26 11:16                 ` Peter Zijlstra
2024-04-26 16:03                   ` Mike Galbraith
2024-04-27  6:42                     ` Mike Galbraith
2024-04-28 16:32                       ` Mike Galbraith
2024-04-29 12:14                         ` Peter Zijlstra
2024-04-15 17:07   ` Luis Machado
2024-04-24 15:15     ` Luis Machado [this message]
2024-04-25 10:42       ` Peter Zijlstra
2024-04-25 11:49         ` Peter Zijlstra
2024-04-26  9:32           ` Peter Zijlstra
2024-04-26  9:36             ` Peter Zijlstra
2024-04-26 10:16             ` Luis Machado
2024-04-29 14:33             ` Luis Machado
2024-05-02 10:26               ` Luis Machado
2024-05-10 14:49                 ` Luis Machado
2024-05-15  9:36                   ` Peter Zijlstra
2024-05-15 11:48                     ` Peter Zijlstra
2024-05-15 18:03                       ` Mike Galbraith
2024-05-20 15:20                       ` Luis Machado
2024-05-29 22:50                 ` Peter Zijlstra
2024-06-03 19:30                   ` Luis Machado
2024-06-04 10:11                     ` Peter Zijlstra
2024-06-04 13:59                       ` Hongyan Xia
2024-06-04 14:23                       ` Luis Machado
2024-06-04 14:49                         ` Hongyan Xia
2024-06-04 19:12                         ` Peter Zijlstra
2024-06-05  7:22                           ` Peter Zijlstra
2024-06-05  9:14                             ` Luis Machado
2024-06-05  9:42                               ` Peter Zijlstra
2024-06-12 15:08                                 ` Luis Machado
2024-05-23  8:45               ` Peter Zijlstra
2024-05-23  9:06                 ` Luis Machado
2024-05-23  9:33                   ` Peter Zijlstra
2024-06-03 15:57                     ` Hongyan Xia
2024-04-26 10:15         ` Luis Machado
2024-04-20  5:57   ` Mike Galbraith
2024-04-22 13:13   ` Tobias Huschle
     [not found]   ` <CA44DAC1-B01A-4208-B9A0-D824E8178974@oracle.com>
2024-07-02 13:08     ` Peter Zijlstra
2024-04-05 10:28 ` [RFC][PATCH 09/10] sched/eevdf: Allow shorter slices to wakeup-preempt Peter Zijlstra
2024-04-05 10:28 ` [RFC][PATCH 10/10] sched/eevdf: Use sched_attr::sched_runtime to set request/slice suggestion Peter Zijlstra
2024-04-06  8:16   ` Hillf Danton
2024-05-07  5:34   ` Mike Galbraith
2024-05-15 10:13     ` Peter Zijlstra
2024-05-07 15:15   ` Chen Yu
2024-05-08 13:52     ` Mike Galbraith
2024-05-09  3:48       ` Chen Yu
2024-05-09  5:00         ` Mike Galbraith
2024-05-13  4:07     ` K Prateek Nayak
2024-05-14  9:18       ` Chen Yu
2024-05-14 15:23         ` K Prateek Nayak
2024-05-14 16:15           ` Chen Yu
2024-05-22 14:48           ` Chen Yu
2024-05-27 10:11 ` [RFC][PATCH 00/10] sched/fair: Complete EEVDF K Prateek Nayak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1461277e-af68-41e7-947c-9178b55810b1@arm.com \
    --to=luis.machado@arm.com \
    --cc=bristot@redhat.com \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=efault@gmx.de \
    --cc=jstultz@google.com \
    --cc=juri.lelli@redhat.com \
    --cc=kprateek.nayak@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=nd@arm.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --cc=vincent.guittot@linaro.org \
    --cc=vschneid@redhat.com \
    --cc=wuyun.abel@bytedance.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®