From patchwork Wed Aug 16 21:20:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 110283 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp1323875qge; Wed, 16 Aug 2017 14:21:33 -0700 (PDT) X-Received: by 10.98.197.70 with SMTP id j67mr2872306pfg.319.1502918493875; Wed, 16 Aug 2017 14:21:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502918493; cv=none; d=google.com; s=arc-20160816; b=A9TNAvRIhKwmyaXla327+8eQG3BtEhuVS7DKMGHShdgekdE/Ncr9oGbUpK+TQUFP/p mROHhU1PWGKjV5qU7VvQh3etkaUTpH+hUoxBxqK/5YjP4+PQkzrs4Q0MoczQ3BXvoPlT c2hKFMH7dmZBlOgCTEkeCH445Ld9IrUtLPwuBfJKL61O9giCR7hFWwPQrM6EcCrHYfnT mm1jIY0rjw7aeMk5jbPhJnSyY63+PWqJXmzPjo279+xPg2/LRpusLfnNkBakREs/BmrW EYG1oiVD8wQYLlm1xB6LlLueS4F8HcSI0vFwrdKG0bp/G0QCkg0B61KtcxnVpCNMUYuh z7TA== 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=CA101HbjwGS/L04BuqPfXwSu0gs0iWBxn7UO5TeOZGw=; b=i7e5o+tyxQz6jr4lYQRtwHFUOTZbxp/ao51to4IgE4l/FqQ3+Mozl+kceJ1BgdMWdV ZYQkt2lkG5XpTeofdim2mk/FDbMUe1AXShO6ytFHYVn9wCWYBiCDTh0XatWYobIW1QWk hVx/14VFbYrza7OIvuBXqU7VQajKp/XDfHYzlSCzN5qcdoOgYm5OddcjoAmlAJ+0r932 oKr5aCbPMVcBNJEmrIrhYCtlPWTJDeEqdL36Aq3ttfhfbBToKn0m3JGnKdetuSVry3Gm 6avdMpik1ohv+a6baXUznLPnAfpMMN7gdQ0BRLogGJgGBLUnse4b6VxriX5VlevG2+I3 6WtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cpzZn7X4; 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.33; Wed, 16 Aug 2017 14:21:33 -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=cpzZn7X4; 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 S1752642AbdHPVVa (ORCPT + 26 others); Wed, 16 Aug 2017 17:21:30 -0400 Received: from mail-io0-f177.google.com ([209.85.223.177]:33820 "EHLO mail-io0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752561AbdHPVVA (ORCPT ); Wed, 16 Aug 2017 17:21:00 -0400 Received: by mail-io0-f177.google.com with SMTP id o9so17467778iod.1 for ; Wed, 16 Aug 2017 14:21:00 -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=CA101HbjwGS/L04BuqPfXwSu0gs0iWBxn7UO5TeOZGw=; b=cpzZn7X4bUDeVitg/ida2LpLmzuXHpq1Jtm28g3kv/LC97iXV4F6/GpRFUNa8pmimO 9YIh2tBnG+RWZRs/9+kG2i/CNnHA2TRl8FSdc1rJBNICne0VWee4mwsYT+cHl8q2B7Li PiFsxBfi50HbnlNTBomnbVb2BhRe90yjGJAzM= 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=CA101HbjwGS/L04BuqPfXwSu0gs0iWBxn7UO5TeOZGw=; b=Fv/q2rxPn+HR5FJoozGnFbNqgrWlXlyYyaKJMZ2sQB6Mnx16/1ldBadR9aOCiJtON+ d2GINy0MBIhrvoAp2F94HKKi0gQUXolHH1mLfaVHWmjxRk0ue91KPVh/V4Cq3UmBgVBK vRH2BNKtv2jFfp+Xoot7/eds5tUyUG+TpQgoCaIOd7fylQ8fnUoeS58BBHvyRjEqm4ko Y1ORK8SK85juviQ8+obDbx7rk/Oaozl5kOdZNA11SNQt/wuVZ8Lk/naCFUt/+viBynHm OoTDMDivyZCXSi4+JYMzFp1bJ0q6xhuLKZTFr2Aq+P9EcnDXqqQzuGVq7xVtPPADaYoD uhZw== X-Gm-Message-State: AHYfb5jYrYGsA8L9MsGskaJgiaM/c+fXQgDgnd/L4boSkMdOnHjLNS+a pSRxLkPgXt4dnaLU X-Received: by 10.107.145.3 with SMTP id t3mr2852439iod.16.1502918460146; Wed, 16 Aug 2017 14:21:00 -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.20.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 16 Aug 2017 14:20:59 -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 6/7] cgroup: Constrain the addition of CPUs to a new CPUset Date: Wed, 16 Aug 2017 15:20:42 -0600 Message-Id: <1502918443-30169-7-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 Care must be taken when CPUs are added to a new CPUset. If an ancestor of that set has its sched_load_balance flag switch off then the CPUs in the new CPUset will be added to a new root domain. If the ancestor also had DL tasks those will end up covering more than one root domain, breaking at the same time the DL integrity model. This patch prevents adding CPUs to a new CPUset if one of its ancestor had its sched_load_balance flag off and had DL tasks assigned to it. Signed-off-by: Mathieu Poirier --- kernel/cgroup/cpuset.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) -- 2.7.4 diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c index 8d2ba5591dfb..fb38feaf3fda 100644 --- a/kernel/cgroup/cpuset.c +++ b/kernel/cgroup/cpuset.c @@ -530,6 +530,28 @@ static int validate_dl_change(struct cpuset *cur, struct cpuset *trial) goto out; } + /* + * CPUs are being added to a CPUset. If any parent of @trial has its + * sched_load_balance flag switched off this operation will create a + * new root domain spanning trailcs->cpus_allowed. At the same time + * if any parent of @trial has a DL task, that task will end up + * spanning more than one root domain. + */ + if (cpumask_empty(cur->cpus_allowed) && + !cpumask_empty(trial->cpus_allowed)) { + struct cpuset *parent; + + parent = parent_cs(trial); + /* Go up until we reach the top_cpuset */ + while (parent) { + if (cpuset_has_dl_tasks(parent) && + !is_sched_load_balance(parent)) + goto out; + + parent = parent_cs(parent); + } + } + ret = 0; out: return ret;