public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Juri Lelli <juri.lelli@redhat.com>
To: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: peterz@infradead.org, lizefan@huawei.com, mingo@redhat.com,
	rostedt@goodmis.org, claudio@evidence.eu.com, bristot@redhat.com,
	tommaso.cucinotta@santannapisa.it, luca.abeni@santannapisa.it,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH V2 3/7] sched/deadline: Keep new DL task within root domain's boundary
Date: Fri, 2 Feb 2018 15:35:21 +0100	[thread overview]
Message-ID: <20180202143521.GU19535@localhost.localdomain> (raw)
In-Reply-To: <1517503869-3179-4-git-send-email-mathieu.poirier@linaro.org>

Hi Mathieu,

On 01/02/18 09:51, Mathieu Poirier wrote:
> When considering to move a task to the DL policy we need to make sure
> the CPUs it is allowed to run on matches the CPUs of the root domains of
> the runqueue it is currently assigned to.  Otherwise the task will be
> allowed to roam on CPUs outside of this root domain, something that will
> skew system deadline statistics and potentially lead to over selling DL
> bandwidth.
> 
> For example say we have a 4 core system split in 2 cpuset: set1 has CPU 0
> and 1 while set2 has CPU 2 and 3.  This results in 3 cpuset - the default
> set that has all 4 CPUs along with set1 and set2 as just depicted.  We also
> have task A that hasn't been assigned to any CPUset and as such, is part of
> the default CPUset.
> 
> At the time we want to move task A to a DL policy it has been assigned to
> CPU1.  Since CPU1 is part of set1 the root domain will have 2 CPUs in it
> and the bandwidth constraint checked against the current DL bandwidth
> allotment of those 2 CPUs.

Wait.. I'm confused. :)

Do you disabled cpuset.sched_load_balance in the root (default) cpuset?
If yes, we would end up with 2 root domains and if task A happens to be
on root domain (0-1) checking its admission against 2 CPUs looks like
the right thing to do to me. If no, then there is a single root domain
(the root/deafult one) with 4 CPUs, and it indeed seems that we've
probably got a problem: it is possible for a DEADLINE task running on
root/default cpuset to be put in (for example) 0-1 cpuset, and so
restrict its affinity. Is it this that this patch cures?

Anyway, see more comments below..

[...]

>  	/*
> +	 * If setscheduling to SCHED_DEADLINE we need to make sure the task
> +	 * is constrained to run within the root domain it is associated with,
> +	 * something that isn't guaranteed when using cpusets.
> +	 *
> +	 * Speaking of cpusets, we also need to assert that a task's
> +	 * cpus_allowed mask equals its cpuset's cpus_allowed mask. Otherwise
> +	 * a DL task could be assigned to a cpuset that has more CPUs than the
> +	 * root domain it is associated with, a situation that yields no
> +	 * benefits and greatly complicate the management of DL task when
> +	 * cpusets are present.
> +	 */
> +	if (dl_policy(policy)) {
> +		struct root_domain *rd = cpu_rq(task_cpu(p))->rd;

I fear root_domain doesn't exist on UP.

Maybe this logic can be put above changing the check we already do
against the span?

https://elixir.free-electrons.com/linux/latest/source/kernel/sched/core.c#L4174

Best,

- Juri

  reply	other threads:[~2018-02-02 14:35 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-01 16:51 [PATCH V2 0/7] sched/deadline: fix cpusets bandwidth accounting Mathieu Poirier
2018-02-01 16:51 ` [PATCH V2 1/7] sched/topology: Adding function partition_sched_domains_locked() Mathieu Poirier
2018-02-02 10:19   ` Juri Lelli
2018-02-05 18:11     ` Mathieu Poirier
2018-02-06  7:42       ` Juri Lelli
2018-02-01 16:51 ` [PATCH V2 2/7] cpuset: Rebuild root domain deadline accounting information Mathieu Poirier
2018-02-02 12:52   ` Juri Lelli
2018-02-05 18:59     ` Mathieu Poirier
2018-02-01 16:51 ` [PATCH V2 3/7] sched/deadline: Keep new DL task within root domain's boundary Mathieu Poirier
2018-02-02 14:35   ` Juri Lelli [this message]
2018-02-05 18:58     ` Mathieu Poirier
2018-02-01 16:51 ` [PATCH V2 4/7] cgroup: Constrain 'sched_load_balance' flag when DL tasks are present Mathieu Poirier
2018-02-01 16:51 ` [PATCH V2 5/7] cgroup: Constrain the addition of CPUs to a new CPUset Mathieu Poirier
2018-02-01 16:51 ` [PATCH V2 6/7] sched/core: Don't change the affinity of DL tasks Mathieu Poirier
2018-02-01 16:51 ` [PATCH V2 7/7] sched/deadline: Prevent CPU hotplug operation if DL task on CPU Mathieu Poirier
2018-02-02 13:17 ` [PATCH V2 0/7] sched/deadline: fix cpusets bandwidth accounting Luca Abeni
2018-02-05 20:48   ` Mathieu Poirier

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=20180202143521.GU19535@localhost.localdomain \
    --to=juri.lelli@redhat.com \
    --cc=bristot@redhat.com \
    --cc=claudio@evidence.eu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizefan@huawei.com \
    --cc=luca.abeni@santannapisa.it \
    --cc=mathieu.poirier@linaro.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=tommaso.cucinotta@santannapisa.it \
    /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