All of lore.kernel.org
 help / color / mirror / Atom feed
From: Quentin Perret <qperret@google.com>
To: Dietmar Eggemann <dietmar.eggemann@arm.com>
Cc: Patrick Bellasi <patrick.bellasi@matbug.net>,
	LKML <linux-kernel@vger.kernel.org>,
	Ingo Molnar <mingo@redhat.com>,
	"Peter Zijlstra (Intel)" <peterz@infradead.org>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Juri Lelli <juri.lelli@redhat.com>, Paul Turner <pjt@google.com>,
	Ben Segall <bsegall@google.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Jonathan Corbet <corbet@lwn.net>,
	Dhaval Giani <dhaval.giani@oracle.com>,
	Josef Bacik <jbacik@fb.com>, Chris Hyser <chris.hyser@oracle.com>,
	Parth Shah <parth@linux.ibm.com>
Subject: Re: [SchedulerWakeupLatency] Skip energy aware task placement
Date: Wed, 29 Jul 2020 15:01:21 +0100	[thread overview]
Message-ID: <20200729140121.GB1075614@google.com> (raw)
In-Reply-To: <2aa4b838-c298-ec7d-08f3-caa50cc87dc2@arm.com>

On Thursday 23 Jul 2020 at 11:31:39 (+0200), Dietmar Eggemann wrote:
> The search for the most energy-efficient CPU over the Performance
> Domains (PDs) by consulting the Energy Model (EM), i.e. the estimation
> on how much energy a PD consumes if the task migrates to one of its
> CPUs, adds a certain amount of latency to task placement.
> 
> For some tasks this extra latency could be too high. A good example here
> are the Android display pipeline tasks, UIThread and RenderThread. They
> have to be placed on idle CPUs with a faster wakeup mechanism than the
> energy aware wakeup path (A) to guarantee the smallest amount of dropped
> or delayed frames (a.k.a. jank).
> 
> In Linux kernel mainline there is currently no mechanism for latency
> sensitive tasks to allow that the energy aware wakeup path (A) is
> skipped and the fast path (B) taken instead.

FWIW, Android has indeed been using a similar concept for many years
(the 'prefer-idle' flag you mentioned below) and that proved to be
critical to meet UI requirements on a number of devices. So +1 to have
this use case covered as part of the latency-nice work.

<...>
> > K) Task-Group tuning: which knobs are required
> 
> Currently Android uses the 'prefer idle' mechanism only on task-groups
> and not on individual tasks.

To add a little bit of context here, Android uses cgroups extensively
for task classification. The tasks of any currently used application are
placed in a cgroup based on their 'role'. For instance, all tasks that
belong to the currently visible application are classified as 'top-app',
and are grouped in a cgroup with 'prefer-idle' set (+ other attributes,
e.g. uclamp). The other tasks in the system are usually placed in other
cgroups (e.g. 'background'), with 'prefer-idle' cleared.

When the user switches from one app to the other, their roles are
swapped. At this point userspace needs to move all tasks of an app from
one cgroup to another, to reflect the change in role. But interestingly,
all tasks of the app belong to the same process, so userspace only needs
to write the PID of the parent task to the new cgroup to move all of
them at once. (Note: we're also experimenting having cgroups per-app
rather than per-role, and to change the cgroup parameters instead of
migrating between groups, but that doesn't change the conclusion below).

So, having 'only' a per-task API for latency-nice may not be sufficient
to cover the Android use-case, as that would force userspace to iterate
over all the tasks in an app when switching between roles, and that will
come at a certain cost (currently unknown). However, that will need to
be confirmed experimentally, and starting 'simple' with a per-task API
would definitely be a step in the right direction.

Thanks,
Quentin

  reply	other threads:[~2020-07-29 14:01 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <87v9kv2545.derkling@matbug.com>
     [not found] ` <87h7wd15v2.derkling@matbug.net>
     [not found]   ` <87imgrlrqi.derkling@matbug.net>
     [not found]     ` <87mu5sqwkt.derkling@matbug.net>
     [not found]       ` <87eer42clt.derkling@matbug.net>
2020-06-23  7:29         ` Scheduler wakeup path tuning surface: Use-Cases and Requirements Patrick Bellasi
2020-06-23  7:49           ` [SchedulerWakeupLatency] Per-task vruntime wakeup bonus Patrick Bellasi
2020-07-10 13:21             ` Vincent Guittot
2020-07-10 19:59               ` Patrick Bellasi
2020-07-13 12:59                 ` Vincent Guittot
2020-07-16 16:48                   ` Dietmar Eggemann
2020-07-17 12:20                     ` Vincent Guittot
2020-07-16 19:54                   ` Patrick Bellasi
2020-07-17 14:19                     ` Vincent Guittot
2020-07-09 12:07           ` [SchedulerTaskPacking] Small background task packing Parth Shah
2020-07-09 23:08             ` [SchedulerWakeupLatency] Skipping Idle Cores and CPU Search chris hyser
2020-07-20  8:47               ` Dietmar Eggemann
2020-07-22 18:56                 ` chris hyser
2020-07-20 15:20             ` [SchedulerTaskPacking] Small background task packing Vincent Guittot
2020-07-23  9:33               ` Parth Shah
2020-07-23  9:31           ` [SchedulerWakeupLatency] Skip energy aware task placement Dietmar Eggemann
2020-07-29 14:01             ` Quentin Perret [this message]
2020-11-12  6:13           ` Scheduler wakeup path tuning surface: Interface discussion Parth Shah

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=20200729140121.GB1075614@google.com \
    --to=qperret@google.com \
    --cc=bsegall@google.com \
    --cc=chris.hyser@oracle.com \
    --cc=corbet@lwn.net \
    --cc=dhaval.giani@oracle.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=jbacik@fb.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=parth@linux.ibm.com \
    --cc=patrick.bellasi@matbug.net \
    --cc=peterz@infradead.org \
    --cc=pjt@google.com \
    --cc=tglx@linutronix.de \
    --cc=vincent.guittot@linaro.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.