linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vincent Guittot <vincent.guittot@linaro.org>
To: Josh Don <joshdon@google.com>
Cc: Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Juri Lelli <juri.lelli@redhat.com>,
	Dietmar Eggemann <dietmar.eggemann@arm.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Benjamin Segall <bsegall@google.com>,
	Mel Gorman <mgorman@suse.de>,
	Daniel Bristot de Oliveira <bristot@redhat.com>,
	Valentin Schneider <vschneid@redhat.com>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	parth@linux.ibm.com, Qais Yousef <qais.yousef@arm.com>,
	"Hyser,Chris" <chris.hyser@oracle.com>,
	Valentin Schneider <valentin.schneider@arm.com>,
	patrick.bellasi@matbug.net, David.Laight@aculab.com,
	Paul Turner <pjt@google.com>,
	pavel@ucw.cz, Tejun Heo <tj@kernel.org>,
	Quentin Perret <qperret@google.com>,
	Tim Chen <tim.c.chen@linux.intel.com>
Subject: Re: [PATCH v2 5/7] sched/fair: Take into account latency nice at wakeup
Date: Mon, 23 May 2022 14:58:41 +0200	[thread overview]
Message-ID: <CAKfTPtBRd-i6sJYpAFTbV-WpPTZt=wUyK0ZKR99+vgsxeTivaw@mail.gmail.com> (raw)
In-Reply-To: <CABk29NvF2H2oSAw806tUQjj39TWNa57bEcbA0ao+qyk5ZgV9Kg@mail.gmail.com>

On Thu, 19 May 2022 at 22:07, Josh Don <joshdon@google.com> wrote:
>
> On Thu, May 19, 2022 at 6:57 AM Vincent Guittot
> <vincent.guittot@linaro.org> wrote:
> >
> > On Tue, 17 May 2022 at 02:54, Josh Don <joshdon@google.com> wrote:
> > >
> > > Hi Vincent,
> > >
> > > On Thu, May 12, 2022 at 9:36 AM Vincent Guittot
> > > <vincent.guittot@linaro.org> wrote:
> > > >
> > > > Take into account the nice latency priority of a thread when deciding to
> > > > preempt the current running thread. We don't want to provide more CPU
> > > > bandwidth to a thread but reorder the scheduling to run latency sensitive
> > > > task first whenever possible.
> > > >
> > > > As long as a thread didn't use its bandwidth, it will be able to preempt
> > > > the current thread.
> > > >
> > > > At the opposite, a thread with a low latency priority will preempt current
> > > > thread at wakeup only to keep fair CPU bandwidth sharing. Otherwise it will
> > > > wait for the tick to get its sched slice.
> > >
> > > Following up from the discussion on the prior series, I'm still not
> > > sure why this approach is exclusive of extending the entity placement
> > > code; I think both changes together would be useful.
> > >
> > > By only changing the wakeup preemption decision, you're only
> > > guaranteeing that the latency-sensitive thing on cpu won't be
> > > preempted until the next sched tick, which can occur at any time
> > > offset from the wakeup, from 0ns to the length of one tick. If a
> >
> > In fact, you are ensured to run a minimum time of 3ms at least on >=8
> > cores system before tick can preempt you. I considered updating this
> > part as well to increase the value for negative weight but didn't do
> > it for now. I can have a look
>
> If the latency sensitive thing on cpu has already been running close
> to or greater than that min granularity, that doesn't apply; can still
> get preempted pretty quickly from the tick by the newly woken task.

The 3ms is ensured from the task wakeup whatever the previous run and
whatever can wakeup in the mean time but didn't preempt it at wakeup.
As mentioned above, it is probably worth having this value scale with
latency, especially for low latency task.

>
> A possible change would be to reduce the sleeper credit when the
> waking entity has lower latency priority than the current entity (ie.
> similar to the se_is_idle() check already being made in
> place_entity()).
>
> > > latency-tolerant task wakes up with a lot of sleeper credit, it would
> > > pretty quickly preempt a latency-sensitive task on-cpu, even if it
> > > doesn't initially do so due to the above changes to wakeup preemption.
> > >
> > > Adjusting place_entity wouldn't impact cpu bandwidth in steady-state
> > > competition between threads of different latency prio, it would only
> > > impact slightly at wakeup, in a similar but more consistent manner to
> > > the changes above to wakeup_preempt_entity (ie. a task that is not
> > > latency sensitive might have to wait a few ticks to preempt a latency
> > > sensitive task, even if it was recently sleeping for a while).

  reply	other threads:[~2022-05-23 12:58 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-12 16:35 [PATCH v2 0/7] Add latency_nice priority Vincent Guittot
2022-05-12 16:35 ` [PATCH v2 1/7] sched: Introduce latency-nice as a per-task attribute Vincent Guittot
2022-05-12 16:35 ` [PATCH v2 2/7] sched/core: Propagate parent task's latency requirements to the child task Vincent Guittot
2022-05-12 16:35 ` [PATCH v2 3/7] sched: Allow sched_{get,set}attr to change latency_nice of the task Vincent Guittot
2022-05-12 16:35 ` [PATCH v2 4/7] sched/core: Add permission checks for setting the latency_nice value Vincent Guittot
2022-05-12 16:35 ` [PATCH v2 5/7] sched/fair: Take into account latency nice at wakeup Vincent Guittot
2022-05-17  0:54   ` Josh Don
2022-05-19 13:55     ` Vincent Guittot
2022-05-19 20:06       ` Josh Don
2022-05-23 12:58         ` Vincent Guittot [this message]
2022-05-12 16:35 ` [PATCH v2 6/7] sched/fair: Add sched group latency support Vincent Guittot
2022-05-12 16:35 ` [PATCH v2 7/7] sched/core: support latency nice with sched core Vincent Guittot
2022-05-13  7:12 ` [PATCH v2 0/7] Add latency_nice priority David Laight
2022-05-13 14:29   ` Vincent Guittot
2022-05-13 21:44 ` Tim Chen
2022-05-19 14:16   ` Vincent Guittot
2022-05-19 18:14     ` Chris Hyser
2022-05-20 18:46       ` Tim Chen
2022-05-23 12:52         ` Vincent Guittot
2022-05-23 13:19           ` David Laight

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='CAKfTPtBRd-i6sJYpAFTbV-WpPTZt=wUyK0ZKR99+vgsxeTivaw@mail.gmail.com' \
    --to=vincent.guittot@linaro.org \
    --cc=David.Laight@aculab.com \
    --cc=bristot@redhat.com \
    --cc=bsegall@google.com \
    --cc=chris.hyser@oracle.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=joshdon@google.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=parth@linux.ibm.com \
    --cc=patrick.bellasi@matbug.net \
    --cc=pavel@ucw.cz \
    --cc=peterz@infradead.org \
    --cc=pjt@google.com \
    --cc=qais.yousef@arm.com \
    --cc=qperret@google.com \
    --cc=rostedt@goodmis.org \
    --cc=tim.c.chen@linux.intel.com \
    --cc=tj@kernel.org \
    --cc=valentin.schneider@arm.com \
    --cc=vschneid@redhat.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;
as well as URLs for NNTP newsgroup(s).