From patchwork Tue Feb 13 20:32:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Poirier X-Patchwork-Id: 128294 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp32460ljc; Tue, 13 Feb 2018 12:33:13 -0800 (PST) X-Google-Smtp-Source: AH8x227zBOBzyyJwzevQr5BJoDKubUl2Fae8PbDY5M4nilCuVpWabg2iYOYzoRjvJ+Aq8Lg3pI0d X-Received: by 10.99.123.12 with SMTP id w12mr1848013pgc.405.1518553993739; Tue, 13 Feb 2018 12:33:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518553993; cv=none; d=google.com; s=arc-20160816; b=kfcqjU0IdbP24YbFb9hgTvmYruPp4dn+ToPKCY8UWGhhZcDeEznuJJaQRqfj6CVZ7B Hlz0tA6B67sR8MLSEtpX6jukrNGE/pZLdhwZP25q3UymA4rdCiZOsjpJDuk5Ky/AZk9j kwCPrBgE7K0ecSfo+RpSgQ9CiJZxAPnybu6tP0+v0LoEq4iCwZWxUFIJ8TnVk5ifDfkB DfLEM/vM2JmOR05iWOmafK67OsUWfR9fSpBq2bzdtnTRkVkEzfexaK6n8a6Z72qldFDu dmn1wdz/pjV5S9L2YhoB7LtQxi8joG1uOPG83Uub4lTWofe5/hldhskvrpkApjs6+PlT 4jAA== 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=oO7ETIAHJvP4bmC3XeX+DrkDkVpYJsA7c39rYbRV7Qc=; b=vUJGorfm4di0BTkKMVJCyEH7WiiwuZBlUpVR3oZjkWwmrhEp+3VsyLBtHA3yVBH4Md 8xMw+vHJhsCODsGf9sBc62fg84Q6OxD9A1lYKAiB4Lc3whELb6FZpKqOD2QGVJQuIWbK bIUHMkLLQdEogUdQscwhq4C61fozZIcIqsbm5xPjxzwGi+ZieDvlKkNYjepQGVtjMiVC Dk/Rww4aZB3yKTmvwp3QmCvWpHl6y5x51V10cmJVKcckhK8dN8AieQRgdR5J2xDO6Xtw zxlf1k+lf/BCzJisDs6Nrk5yqSasrAuwoq5YAjff4RbitP3YM7/8//i3qgeXHzSINdR7 SU5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PXNG1elb; 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 b65si1113993pfl.179.2018.02.13.12.33.13; Tue, 13 Feb 2018 12:33:13 -0800 (PST) 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=PXNG1elb; 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 S965868AbeBMUdK (ORCPT + 28 others); Tue, 13 Feb 2018 15:33:10 -0500 Received: from mail-pl0-f67.google.com ([209.85.160.67]:44530 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965789AbeBMUdG (ORCPT ); Tue, 13 Feb 2018 15:33:06 -0500 Received: by mail-pl0-f67.google.com with SMTP id w21so205524plp.11 for ; Tue, 13 Feb 2018 12:33:05 -0800 (PST) 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=oO7ETIAHJvP4bmC3XeX+DrkDkVpYJsA7c39rYbRV7Qc=; b=PXNG1elbWSLD8EY662YNAvJfv6PKwdRA9rGyUddZR8bccgwb8lzZfcrKN0AQ0XAC6R FBhflkngS7BUBHqHF54ZekNLk03a5L+n7bYzpLNCQALygv7QuDlMbRcTWtcP00Zy/SnV 00du0m/PYo/DZBElLyo3Q0YUnB321xbV4vPtw= 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=oO7ETIAHJvP4bmC3XeX+DrkDkVpYJsA7c39rYbRV7Qc=; b=m6ltWxFIiusBdipMc2Mvqp7Z3SfEE9ya0e6PIo11jvI2kv3OHikg17QnZ/58ESOvDx QNwjQJGHULNFnKmL2t+aSVdS+kS/U6dCDBpXhTHd71GFdz7C2M2aTWty2UIUYOwkBu1m 540xpY5dP32xyYa9D/cV0Yp0mi+Pbdiwfw7pengTA+Megsjh1yBLpJzByvrUcKji9fuy EOLC5o9q3A0oH4UHSKr2rkRGnTVhtFfJVAcAV2bTDUNZkzLqXSiT5/kpemwePvDZmFMb jAT760dc3PUzQn4S9EIVd3lBnmQgVi1CKTpxunJZgY+C+hHroAQV8NyTKoYOJthJ7/OF aBGw== X-Gm-Message-State: APf1xPCu19pPGKhtrg1hyyk8uo8OVBSduiO8xeuBdLs+3Oo9g8EvKy1S kFuLby2uENtrfvMFtZ9UpyGlJw== X-Received: by 2002:a17:902:6843:: with SMTP id f3-v6mr2183743pln.182.1518553985400; Tue, 13 Feb 2018 12:33:05 -0800 (PST) Received: from xps15.cg.shawcable.net (S0106002369de4dac.cg.shawcable.net. [68.147.8.254]) by smtp.gmail.com with ESMTPSA id o135sm35540873pfg.45.2018.02.13.12.33.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 13 Feb 2018 12:33:04 -0800 (PST) From: Mathieu Poirier To: peterz@infradead.org Cc: lizefan@huawei.com, mingo@redhat.com, rostedt@goodmis.org, claudio@evidence.eu.com, bristot@redhat.com, tommaso.cucinotta@santannapisa.it, juri.lelli@redhat.com, luca.abeni@santannapisa.it, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH V3 09/10] sched/core: Don't change the affinity of DL tasks Date: Tue, 13 Feb 2018 13:32:46 -0700 Message-Id: <1518553967-20656-10-git-send-email-mathieu.poirier@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1518553967-20656-1-git-send-email-mathieu.poirier@linaro.org> References: <1518553967-20656-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 utilisation 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 b930857f4d14..7a265478d873 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -4773,15 +4773,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;