Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752615AbdHPVVG (ORCPT ); Wed, 16 Aug 2017 17:21:06 -0400 Received: from mail-it0-f53.google.com ([209.85.214.53]:34935 "EHLO mail-it0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752488AbdHPVVD (ORCPT ); Wed, 16 Aug 2017 17:21:03 -0400 From: Mathieu Poirier To: mingo@redhat.com, peterz@infradead.org Cc: tj@kernel.org, vbabka@suse.cz, lizefan@huawei.com, akpm@linux-foundation.org, weiyongjun1@huawei.com, juri.lelli@arm.com, rostedt@goodmis.org, claudio@evidence.eu.com, luca.abeni@santannapisa.it, bristot@redhat.com, linux-kernel@vger.kernel.org, mathieu.poirier@linaro.org Subject: [PATCH 7/7] sched/core: Don't change the affinity of DL tasks Date: Wed, 16 Aug 2017 15:20:43 -0600 Message-Id: <1502918443-30169-8-git-send-email-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1502918443-30169-1-git-send-email-mathieu.poirier@linaro.org> References: <1502918443-30169-1-git-send-email-mathieu.poirier@linaro.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1764 Lines: 44 Now that we mandate that on creation, the ->cpus_allowed mask of a future DL task has to be equal to the rd->span of the root domain it will be associated with, changing the affinity of a DL task doesn't make sense anymore. Indeed, if we set the task to a smaller affinity set then we may be running out of CPU cycle. If we try to increase the size of the affinity set the new CPUs are necessarily part of another root domain where DL utilation for the task won't be accounted for. As such simply refuse to change the affinity set of a DL task. Signed-off-by: Mathieu Poirier --- kernel/sched/core.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 0869b20fba81..a1948d127d8f 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -4629,15 +4629,15 @@ long sched_setaffinity(pid_t pid, const struct cpumask *in_mask) cpumask_and(new_mask, in_mask, cpus_allowed); /* - * Since bandwidth control happens on root_domain basis, - * if admission test is enabled, we only admit -deadline - * tasks allowed to run on all the CPUs in the task's - * root_domain. + * Since bandwidth control happens on root_domain basis, if admission + * test is enabled, we don't allow the task' CPUs to change. If + * @new_mask is smaller than we risk running out of cycles. If it is + * bigger than we may be using DL bandwidth allocated to other CPUs. */ #ifdef CONFIG_SMP if (task_has_dl_policy(p) && dl_bandwidth_enabled()) { rcu_read_lock(); - if (!cpumask_subset(task_rq(p)->rd->span, new_mask)) { + if (!cpumask_equal(task_rq(p)->rd->span, new_mask)) { retval = -EBUSY; rcu_read_unlock(); goto out_free_new_mask; -- 2.7.4