From patchwork Wed Aug 16 21:20:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 110282 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp1323558qge; Wed, 16 Aug 2017 14:21:11 -0700 (PDT) X-Received: by 10.84.210.165 with SMTP id a34mr3204293pli.478.1502918471156; Wed, 16 Aug 2017 14:21:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502918471; cv=none; d=google.com; s=arc-20160816; b=YGwY2VkkaAJRtzbxkt2amCcY/rNiFsIW+aePg81GeMgdFJJbjn55g7QE6qVZSjJnTG mMR7jwdHpy/QdH6iAzgtKOP50BVLJ3VhSArsmi98nA/0C0UzuMOkEgeWRvHxy7ywXszH omZjeaCCEitaB27nffGltvMmKQX4++5ZlUaXPQZhrIhAhHmpryIrqAN3i4+Wu5miCvUR Z5aEGIfAxxN5Y2cJUnNiFqmdqvlvoTr7uirDHPDzbqtb6r8vBdAeGhMIr8Dam0gMX+W0 NCLGVdqhguIfE5ieF/2+coDx5dpGIPGA6S+BkBQvGg1oGyYc/mrn3aykNY4Kk3NOFXzV 2r0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=st88wpeLOIoulo26dBXbcumaT8k6YLu4JnjG+AFEht0=; b=BCxF1mnArWN0wFtVcBnidWlHFl76t12CjOMb8VZmzpcq/CbkNznGe9GJKnN0QMiYwZ 6RjvwB8ByzDr6Yq/ti9sNpOsjnkLTUVi4zlMSXGmdZxV6+1X2zZOCPPYRWH7B1+5w3A9 gs4+sUHvpdP+RUfLLWGF9L8/20kF3WbcUcRPgWRHBxSh/0XjUqu3X1LroLcxQl9ewx55 U6sscx4pufZg4KTjF6Hsk6NwYebcP/VF7L4zsGszKKWXGE3HdLNOKLJc/q2JyAN8A40f 18QCIYo2E6pRiFSnW+U3YMnW7+hI7PIEsUgB7t8EyY2zcXjwo0pe1fKpVE+xSxoBoknD fxNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MiSbYqhM; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t8si1036974pfe.331.2017.08.16.14.21.10; Wed, 16 Aug 2017 14:21:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MiSbYqhM; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752617AbdHPVVG (ORCPT + 26 others); 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 Received: by mail-it0-f53.google.com with SMTP id 76so23295694ith.0 for ; Wed, 16 Aug 2017 14:21:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=st88wpeLOIoulo26dBXbcumaT8k6YLu4JnjG+AFEht0=; b=MiSbYqhMyJhfBfR6DT4od99FbR9h6X+uCH0J+yn04IrBAMxnHrs6QssqRnPIo56aO9 XvjD0MFkDdj7vxtwjIoeFikZsCR8cKWRCyeH6gSZX2tdyhitlm2ZSKdHVn5DZeM4djE9 UcjVEdOWlwPStEuknlpS41+T/ACBujNmhYxjM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=st88wpeLOIoulo26dBXbcumaT8k6YLu4JnjG+AFEht0=; b=gdsFrtDTD6eodZk8Yl4E4K4MIHI7xZkZHRK+G1e/YH8iFKUZH4L+8msB/FPa2I+x3r oS1dfs1zA6+s9fSmkTG1ImeKcJcz9NANFvSyCd03LVP6XXreiy6OXa/PKhr99T6izkRU Hv/EXjZNo0381S8pbGlvU7+5qDe2FwS26PDyJM8aulFnqaP6q8wG3PfFzo7zRjRebCig MKnWVonjDTIGq+/cU4QZQ0LaADX4jFsO4hRqevE42Uda02RAOg2XruyRXipaDL5Knvn+ e6ni7iHNusUc0SwT6KDWrEKFptwsdbPDAwaH4sZq99qhMPuDPOW76J+7c5k7MHmx/cXc wOgw== X-Gm-Message-State: AHYfb5j3Qpox5uhBOOiG5zl04JbfDYPejhrWZ9RmFpCqJIambNvLoDrp u81vPciugPSyeWKL X-Received: by 10.36.195.196 with SMTP id s187mr427622itg.112.1502918462631; Wed, 16 Aug 2017 14:21:02 -0700 (PDT) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id 80sm918281itk.11.2017.08.16.14.21.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 16 Aug 2017 14:21:01 -0700 (PDT) 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(-) -- 2.7.4 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;