All of lore.kernel.org
 help / color / mirror / Atom feed
From: luca abeni <luca.abeni@santannapisa.it>
To: Dietmar Eggemann <dietmar.eggemann@arm.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Juri Lelli <juri.lelli@redhat.com>,
	Ingo Molnar <mingo@kernel.org>,
	Daniel Bristot de Oliveira <bristot@redhat.com>,
	Valentin Schneider <Valentin.Schneider@arm.com>,
	Qais Yousef <Qais.Yousef@arm.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 4/5] sched/deadline: Cleanup on_dl_rq() handling
Date: Wed, 31 Jul 2019 22:20:46 +0200	[thread overview]
Message-ID: <20190731222046.5ff83259@sweethome> (raw)
In-Reply-To: <c93f6c12-b804-99da-7e38-bbaf55fe7a1b@arm.com>

On Wed, 31 Jul 2019 18:32:47 +0100
Dietmar Eggemann <dietmar.eggemann@arm.com> wrote:
[...]
> >>>>  static void dequeue_dl_entity(struct sched_dl_entity *dl_se)
> >>>>  {
> >>>> +	if (!on_dl_rq(dl_se))
> >>>> +		return;  
> >>>
> >>> Why allow double dequeue instead of WARN?  
> >>
> >> As I was saying to Valentin, it can currently happen that a task
> >> could have already been dequeued by update_curr_dl()->throttle
> >> called by dequeue_task_dl() before calling __dequeue_task_dl(). Do
> >> you think we should check for this condition before calling into
> >> dequeue_dl_entity()?  
> > 
> > Yes, that's what ->dl_throttled is for, right? And !->dl_throttled
> > && !on_dl_rq() is a BUG.  
> 
> OK, I will add the following snippet to the patch.
> Although it's easy to provoke a situation in which DL tasks are
> throttled, I haven't seen a throttling happening when the task is
> being dequeued.

This is a not-so-common situation, that can happen with periodic tasks
(a-la rt-app) blocking on clock_nanosleep() (or similar) after
executing for an amount of time comparable with the SCHED_DEADLINE
runtime.

It might happen that the task consumed a little bit more than the
remaining runtime (but has not been throttled yet, because the
accounting happens at every tick)... So, when dequeue_task_dl() invokes
update_task_dl() the runtime becomes negative and the task is throttled.

This happens infrequently, but if you try rt-app tasksets with multiple
tasks and execution times near to the runtime you will see it
happening, sooner or later.


[...]
> @@ -1592,6 +1591,10 @@ static void __dequeue_task_dl(struct rq *rq,
> struct task_struct *p) static void dequeue_task_dl(struct rq *rq,
> struct task_struct *p, int flags) {
>         update_curr_dl(rq);
> +
> +       if (p->dl.dl_throttled)
> +               return;

Sorry, I missed part of the previous discussion, so maybe I am missing
something... But I suspect this "return" might be wrong (you risk to
miss a call to task_non_contending(), coming later in this function).

Maybe you cound use
	if (!p->dl_throttled)
		__dequeue_task_dl(rq, p)

Or did I misunderstand something?



			Thanks,
				Luca

  reply	other threads:[~2019-07-31 20:21 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-26  8:27 [PATCH 0/5] sched/deadline: Fix double accounting in push_dl_task() & some cleanups Dietmar Eggemann
2019-07-26  8:27 ` [PATCH 1/5] sched/deadline: Fix double accounting of rq/running bw in push_dl_task() Dietmar Eggemann
2019-07-26 10:11   ` luca abeni
2019-07-29  8:59     ` Dietmar Eggemann
2019-07-29 16:10       ` Peter Zijlstra
2019-07-26 13:30   ` luca abeni
2019-07-29  9:00     ` Dietmar Eggemann
2019-07-31 10:32       ` Dietmar Eggemann
2019-07-26  8:27 ` [PATCH 2/5] sched/deadline: Remove unused int flags from __dequeue_task_dl() Dietmar Eggemann
2019-07-29 16:35   ` Peter Zijlstra
2019-07-29 17:12     ` Dietmar Eggemann
2019-07-26  8:27 ` [PATCH 3/5] sched/deadline: Use __sub_running_bw() throughout dl_change_utilization() Dietmar Eggemann
2019-07-29 16:47   ` Peter Zijlstra
2019-07-29 17:21     ` Dietmar Eggemann
2019-07-26  8:27 ` [PATCH 4/5] sched/deadline: Cleanup on_dl_rq() handling Dietmar Eggemann
2019-07-26  8:37   ` Valentin Schneider
2019-07-26  8:58     ` Qais Yousef
2019-07-26  9:20     ` Juri Lelli
2019-07-26  9:32       ` Valentin Schneider
2019-07-29 16:49   ` Peter Zijlstra
2019-07-30  6:41     ` Juri Lelli
2019-07-30  8:21       ` Peter Zijlstra
2019-07-31 17:32         ` Dietmar Eggemann
2019-07-31 20:20           ` luca abeni [this message]
2019-08-01 16:01             ` Dietmar Eggemann
2019-07-26  8:27 ` [PATCH 5/5] sched/deadline: Use return value of SCHED_WARN_ON() in bw accounting Dietmar Eggemann
2019-07-26 10:18   ` luca abeni
2019-07-29 16:54     ` Peter Zijlstra
2019-07-29 16:59       ` Dietmar Eggemann
2019-07-30  8:23         ` Peter Zijlstra
2019-07-30 16:08           ` Dietmar Eggemann

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=20190731222046.5ff83259@sweethome \
    --to=luca.abeni@santannapisa.it \
    --cc=Qais.Yousef@arm.com \
    --cc=Valentin.Schneider@arm.com \
    --cc=bristot@redhat.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.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.