Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp2407434ybt; Tue, 16 Jun 2020 05:28:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzmXADYWIwUCxzUSQTPM5Xl/YT0RPd17vY0o92DiI2fuFtkHZWncQReQ4QpeX4Ip1wmdOUD X-Received: by 2002:a17:906:fb9b:: with SMTP id lr27mr2428185ejb.405.1592310530211; Tue, 16 Jun 2020 05:28:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592310530; cv=none; d=google.com; s=arc-20160816; b=jT2EghJMhD+2k4LQOd62lz3X5JWunOAmYbX8ojhoeJTthLMPFhiUuSd7oyBqgbIFA9 EDPZjy4vTXGHndel1b/YWWpJQifpxL/THAzpPnM4hbcqP1wJgC+Q+9aqkbo9nD1vqd+Z ENnKcOoYdzbCqOVWpS7vrO6Fz/EyaqPeLY8Lk/ZOzrHEIhFmbKwpxpnMmmvvPfTe6MkE RhCErOFmuP8/MwjPp8HhVC11xue2sNb2lZsnfPMA6ZRVKPBzsLFr6YbwK7bhL9eNJ2A0 409jasLn4lmcbiq4Z3eJAI5J3fcK1b64NEXaIs0C5RWNPp3jxDnbP/hf6sRZ90oEVgzM nnXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :robot-unsubscribe:robot-id:message-id:mime-version:references :in-reply-to:cc:subject:to:reply-to:from:date; bh=DE8sB0qzEFEs14PTU+kz/Zs+HudWOsR35PCfBxbUlg8=; b=TaDvq3gzQkTEoZnhKWK1tSNhsuiMaEzEAVeFaPkurkXQR57DAY4YjW4O1Uq9h5H6XN HFpjdD3//gAa4fBSXRWtNYHYgyTz7httGEIcfARFnq/wx2XLy3CQ0fB+dZWsywQ18jBm cHYFjJwwDdKkoE3DmQo2SiCOahHi7fWH1BlnY0Jt/Ts1WtjlmTnXhOE6PkKqj+AIrPcY fuxTyz1RvFvGeSFm6NES4YdL1EJZVfBQgazfP8Oo9hke7yQC3P1qteKQ7461JcyhUjLP b4BwCgjBmsrKCpkMZzSx+xcBzYcbUnPKXbWc3dF5mnYerUch/yJCLPPc++eye3EHXfCI /0Lg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g17si10529453ejm.633.2020.06.16.05.28.27; Tue, 16 Jun 2020 05:28:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729368AbgFPMXy (ORCPT + 99 others); Tue, 16 Jun 2020 08:23:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728876AbgFPMWC (ORCPT ); Tue, 16 Jun 2020 08:22:02 -0400 Received: from Galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E983C08C5C3; Tue, 16 Jun 2020 05:22:01 -0700 (PDT) Received: from [5.158.153.53] (helo=tip-bot2.lab.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1jlAbE-0004fs-Iy; Tue, 16 Jun 2020 14:21:56 +0200 Received: from [127.0.1.1] (localhost [IPv6:::1]) by tip-bot2.lab.linutronix.de (Postfix) with ESMTP id 59C711C0823; Tue, 16 Jun 2020 14:21:52 +0200 (CEST) Date: Tue, 16 Jun 2020 12:21:52 -0000 From: "tip-bot2 for Dietmar Eggemann" Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: sched/core] sched/deadline: Add dl_bw_capacity() Cc: Dietmar Eggemann , "Peter Zijlstra (Intel)" , Juri Lelli , x86 , LKML In-Reply-To: <20200520134243.19352-3-dietmar.eggemann@arm.com> References: <20200520134243.19352-3-dietmar.eggemann@arm.com> MIME-Version: 1.0 Message-ID: <159231011211.16989.3507232109054333136.tip-bot2@tip-bot2> X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the sched/core branch of tip: Commit-ID: fc9dc698472aa460a8b3b036d9b1d0b751f12f58 Gitweb: https://git.kernel.org/tip/fc9dc698472aa460a8b3b036d9b1d0b751f12f58 Author: Dietmar Eggemann AuthorDate: Wed, 20 May 2020 15:42:40 +02:00 Committer: Peter Zijlstra CommitterDate: Mon, 15 Jun 2020 14:10:05 +02:00 sched/deadline: Add dl_bw_capacity() Capacity-aware SCHED_DEADLINE Admission Control (AC) needs root domain (rd) CPU capacity sum. Introduce dl_bw_capacity() which for a symmetric rd w/ a CPU capacity of SCHED_CAPACITY_SCALE simply relies on dl_bw_cpus() to return #CPUs multiplied by SCHED_CAPACITY_SCALE. For an asymmetric rd or a CPU capacity < SCHED_CAPACITY_SCALE it computes the CPU capacity sum over rd span and cpu_active_mask. A 'XXX Fix:' comment was added to highlight that if 'rq->rd == def_root_domain' AC should be performed against the capacity of the CPU the task is running on rather the rd CPU capacity sum. This issue already exists w/o capacity awareness. Signed-off-by: Dietmar Eggemann Signed-off-by: Peter Zijlstra (Intel) Acked-by: Juri Lelli Link: https://lkml.kernel.org/r/20200520134243.19352-3-dietmar.eggemann@arm.com --- kernel/sched/deadline.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c index ec90265..01f474a 100644 --- a/kernel/sched/deadline.c +++ b/kernel/sched/deadline.c @@ -69,6 +69,34 @@ static inline int dl_bw_cpus(int i) return cpus; } + +static inline unsigned long __dl_bw_capacity(int i) +{ + struct root_domain *rd = cpu_rq(i)->rd; + unsigned long cap = 0; + + RCU_LOCKDEP_WARN(!rcu_read_lock_sched_held(), + "sched RCU must be held"); + + for_each_cpu_and(i, rd->span, cpu_active_mask) + cap += capacity_orig_of(i); + + return cap; +} + +/* + * XXX Fix: If 'rq->rd == def_root_domain' perform AC against capacity + * of the CPU the task is running on rather rd's \Sum CPU capacity. + */ +static inline unsigned long dl_bw_capacity(int i) +{ + if (!static_branch_unlikely(&sched_asym_cpucapacity) && + capacity_orig_of(i) == SCHED_CAPACITY_SCALE) { + return dl_bw_cpus(i) << SCHED_CAPACITY_SHIFT; + } else { + return __dl_bw_capacity(i); + } +} #else static inline struct dl_bw *dl_bw_of(int i) { @@ -79,6 +107,11 @@ static inline int dl_bw_cpus(int i) { return 1; } + +static inline unsigned long dl_bw_capacity(int i) +{ + return SCHED_CAPACITY_SCALE; +} #endif static inline