All of lore.kernel.org
 help / color / mirror / Atom feed
From: Juri Lelli <juri.lelli@gmail.com>
To: Steven Rostedt <rostedt@goodmis.org>,
	LKML <linux-kernel@vger.kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@kernel.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH] sched/deadline: Update total bandwidth when adding new task
Date: Wed, 19 Feb 2014 11:07:30 +0100	[thread overview]
Message-ID: <53048262.4000200@gmail.com> (raw)
In-Reply-To: <20140218215659.2a3ddd8f@gandalf.local.home>

On 02/19/2014 03:56 AM, Steven Rostedt wrote:
> While debugging the crash with the bad nr_running accounting, I hit
> another bug where, after running my sched deadline test, I was getting
> failures to take a CPU offline. It was giving me a -EBUSY error.
> 
> Adding a bunch of trace_printk()s around, I found that the cpu
> notifier that called sched_cpu_inactive() was returning a failure. The
> overflow value was coming up negative?
> 
> Adding more trace_printk()s, I found that task_dead_dl() function was
> subtracting the exact amount that was keeping the CPU from going
> offline. I then realized that the task_dead_dl() was updating the
> total_bw for the task that was going away, but there was nothing that
> added to the total_bw when the task came alive. 

We call __dl_add() from dl_overflow(), right before calling __setscheduler().

> If total_bw is not
> zero for a CPU, it will keep that CPU from going offline.
> 
> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
> ---
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index b46131e..17f4830 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -3178,6 +3178,7 @@ static void
>  __setparam_dl(struct task_struct *p, const struct sched_attr *attr)
>  {
>  	struct sched_dl_entity *dl_se = &p->dl;
> +	struct dl_bw *dl_b = dl_bw_of(task_cpu(p));
>  
>  	init_dl_task_timer(dl_se);
>  	dl_se->dl_runtime = attr->sched_runtime;
> @@ -3187,6 +3188,7 @@ __setparam_dl(struct task_struct *p, const struct sched_attr *attr)
>  	dl_se->dl_bw = to_ratio(dl_se->dl_period, dl_se->dl_runtime);
>  	dl_se->dl_throttled = 0;
>  	dl_se->dl_new = 1;
> +	__dl_add(dl_b, dl_se->dl_bw);
>  }

This is intended to set params for a task that is going to become -deadline. I
don't think it is the right place to update dl_b. And it seems you add it twice
(inside dl_overflow and inside __setscheduler).

I performed some tests, and it seems that dl_b is updated correctly, once when
the task is started and once when task_dead_dl() is called.

That said, I'm still testing with your stress-cpu-hotplug.

Thanks,

- Juri

>  
>  /* Actually do priority change: must hold pi & rq lock. */
> 

  reply	other threads:[~2014-02-19 10:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-19  2:56 [PATCH] sched/deadline: Update total bandwidth when adding new task Steven Rostedt
2014-02-19 10:07 ` Juri Lelli [this message]
2014-02-19 18:53 ` [PATCH] sched/deadline: Fix overflow to handle period==0 and deadline!=0 Steven Rostedt
2014-02-20  7:47   ` Juri Lelli
2014-02-21 20:31   ` [tip:sched/urgent] sched/deadline: Fix overflow to handle period= =0 " tip-bot for Steven Rostedt

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=53048262.4000200@gmail.com \
    --to=juri.lelli@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.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.