All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Juri Lelli <juri.lelli@arm.com>
Cc: Steven Rostedt <rostedt@goodmis.org>,
	luca abeni <luca.abeni@unitn.it>,
	linux-kernel@vger.kernel.org, mingo@redhat.com,
	vincent.guittot@linaro.org, wanpeng.li@hotmail.com
Subject: Re: [PATCH 1/2] sched/deadline: add per rq tracking of admitted bandwidth
Date: Fri, 12 Feb 2016 18:05:30 +0100	[thread overview]
Message-ID: <20160212170530.GU6357@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <20160211171012.GS11415@e106622-lin>

On Thu, Feb 11, 2016 at 05:10:12PM +0000, Juri Lelli wrote:
> diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
> index 6368f43..1eccecf 100644
> --- a/kernel/sched/deadline.c
> +++ b/kernel/sched/deadline.c

> +static void swap_task_ac_bw(struct task_struct *p,
> +			    struct rq *from,
> +			    struct rq *to)
> +{
> +	unsigned long flags;
> +
> +	lockdep_assert_held(&p->pi_lock);
> +	local_irq_save(flags);
> +	double_rq_lock(from, to);
> +	__dl_sub_ac(from, p->dl.dl_bw);
> +	__dl_add_ac(to, p->dl.dl_bw);
> +	double_rq_unlock(from, to);
> +	local_irq_restore(flags);
> +}

> +static void migrate_task_rq_dl(struct task_struct *p)
> +{
> +	if (p->fallback_cpu != -1)
> +		swap_task_ac_bw(p, task_rq(p), cpu_rq(p->fallback_cpu));
> +}

This patch scares me.

Now, my brain is having an awfully hard time trying to re-engage after
flu, but this looks very wrong.

So we call sched_class::migrate_task_rq() from set_task_cpu(), and we
call set_task_cpu() while potentially holding rq::lock's (try
push_dl_task() for kicks).

Sure, you play horrible games with fallback_cpu, but those games are
just that, horrible.


So your initial patch migrates the bandwidth along when a runnable task
gets moved about, this hack seems to be mostly about waking up. The
'normal' accounting is done on enqueue/dequeue, while here you use the
migration hook.

Having two separate means of accounting this also feels more fragile
than one would want.

Let me think a bit about this.

  reply	other threads:[~2016-02-12 17:05 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-08 12:45 [PATCH 0/2] sched/deadline: fix cpusets bandwidth accounting Juri Lelli
2016-02-08 12:45 ` [PATCH 1/2] sched/deadline: add per rq tracking of admitted bandwidth Juri Lelli
2016-02-10 11:32   ` Juri Lelli
2016-02-10 11:43     ` luca abeni
2016-02-10 11:58       ` Juri Lelli
2016-02-19 13:43         ` luca abeni
2016-02-19 14:20           ` Steven Rostedt
2016-02-19 14:53             ` luca abeni
2016-02-19 14:57               ` Steven Rostedt
2016-02-22 11:03               ` luca abeni
2016-02-22 10:57         ` [PATCH 0/3] cleanup " Luca Abeni
2016-02-22 10:57           ` [PATCH 1/4] Move some calls to __dl_{sub,add}_ac() from core.c to deadline.c Luca Abeni
2016-02-22 10:57           ` [PATCH 2/4] Move the remaining __dl_{sub,add}_ac() calls " Luca Abeni
2016-02-22 10:57           ` [PATCH 3/4] Remove dl_new Luca Abeni
2016-02-23 15:42             ` Peter Zijlstra
2016-02-24 13:53               ` luca abeni
2016-02-25  9:46                 ` Juri Lelli
2016-03-03  9:03                   ` luca abeni
2016-03-03  9:28                     ` Juri Lelli
2016-03-03 14:23                       ` Steven Rostedt
2016-03-03 14:31                         ` luca abeni
2016-03-03 16:12                         ` Juri Lelli
2016-02-10 12:48     ` [PATCH 1/2] sched/deadline: add per rq tracking of admitted bandwidth luca abeni
2016-02-10 13:42       ` Juri Lelli
2016-02-23 15:48         ` Peter Zijlstra
2016-02-23 15:51           ` Juri Lelli
2016-02-10 14:37     ` Steven Rostedt
2016-02-10 16:27       ` Juri Lelli
2016-02-11 12:12         ` Juri Lelli
2016-02-11 12:22           ` luca abeni
2016-02-11 12:27             ` Juri Lelli
2016-02-11 12:40               ` luca abeni
2016-02-11 12:49                 ` Juri Lelli
2016-02-11 13:05                   ` luca abeni
2016-02-11 14:25                     ` Steven Rostedt
2016-02-11 17:10                       ` Juri Lelli
2016-02-12 17:05                         ` Peter Zijlstra [this message]
2016-02-12 17:19                           ` Juri Lelli
2016-02-24 19:17                           ` Peter Zijlstra
2016-02-24 21:46                             ` luca abeni
2016-02-25  7:53                               ` Peter Zijlstra
2016-02-25 10:07                             ` Juri Lelli
2016-02-25 10:20                               ` Peter Zijlstra
2016-03-24  9:20                                 ` Peter Zijlstra
2016-02-11 21:48                       ` Luca Abeni
2016-02-08 12:45 ` [PATCH 2/2] sched/deadline: rq_{online,offline}_dl for root_domain changes Juri Lelli

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=20160212170530.GU6357@twins.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=juri.lelli@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luca.abeni@unitn.it \
    --cc=mingo@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=vincent.guittot@linaro.org \
    --cc=wanpeng.li@hotmail.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 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.