Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp2649807ybz; Mon, 27 Apr 2020 01:39:55 -0700 (PDT) X-Google-Smtp-Source: APiQypKagPpjVJancbSqt1TUOSO+FLCXOI0m2hMjPywamd4NS/1c1UAbQ7i7GyLHJM1deASnBqrL X-Received: by 2002:a17:906:405a:: with SMTP id y26mr18084733ejj.31.1587976795210; Mon, 27 Apr 2020 01:39:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587976795; cv=none; d=google.com; s=arc-20160816; b=ZE/2iRbIm3Niws3Ki/YWJG1wI6sm6vTfv7MPf2ZQSenBEUKBzliSYgLy6upO5QfPMu tc4uGyMOrhCAnXckzGEVJ2QlfYviPvKLKlW4I5SveQ2RhRyGQ6Hvwzb0shRtptXbuboh /zXfSf74RsUIqle+J9GvMIgM0cK2dZ/DUmM9u5cetQtBwHWTeAdQMSob22RGh0NTM4/5 vNf/UAz7M2XdMzEGSjGg2eIYFPJUFW1jYk2ow7yV/QLwt10t+W9KGXQjc0gwSYDlUtUQ PRolIrhavcRPWTLBSayNaMQ5pbTlPvTPBS4x9aUYOl4b0dsyekqEcdHWV96HF/058xFy r/qQ== 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; bh=TyVJiskGPU7RdO7Aw2bF8C3IpptTnPypJFYm2h2L9fg=; b=wTVpQYkJfRsJPWp7neuuL7Mqg0K888aSbOwJTNGB3jHy+CjAUIxrcZaYBBwbGr9hqk 8vxrFnvSfk0EMdEI70E1Yuq1aTw7mcdQKBdz9eQ8JHN1XSI1dSubrpcYG5/KAfgf/BvU 6l9TezbG4hxhd0PiKbFHzAnS74DQyxOWHyjidaib9ZPe6cIAEiiSNRC6jyoyvWgnNw4u dQTxQx2jSHW3RL0qn48TyHDFqwxV8SJVXWAId0jKNSBDyQLyR/QBgrth3NSnlCDeLG1y JEwI0pGF/NVOlpSLliRLGcPRSqafS61nr6fL5lfJuXRMPOrELNt46g33iHQTJGELJ3Pk zkdw== 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 k4si4362645edr.26.2020.04.27.01.39.32; Mon, 27 Apr 2020 01:39:55 -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 S1726822AbgD0Iho (ORCPT + 99 others); Mon, 27 Apr 2020 04:37:44 -0400 Received: from foss.arm.com ([217.140.110.172]:59922 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725899AbgD0Iho (ORCPT ); Mon, 27 Apr 2020 04:37:44 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9F00011B3; Mon, 27 Apr 2020 01:37:43 -0700 (PDT) Received: from dell3630.arm.com (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 4FAD93F68F; Mon, 27 Apr 2020 01:37:39 -0700 (PDT) From: Dietmar Eggemann To: Ingo Molnar , Peter Zijlstra , Juri Lelli Cc: Vincent Guittot , Steven Rostedt , Luca Abeni , Daniel Bristot de Oliveira , Wei Wang , Quentin Perret , Alessio Balsini , Pavan Kondeti , Patrick Bellasi , Morten Rasmussen , Valentin Schneider , Qais Yousef , linux-kernel@vger.kernel.org Subject: [PATCH v2 3/6] sched/deadline: Add dl_bw_capacity() Date: Mon, 27 Apr 2020 10:37:06 +0200 Message-Id: <20200427083709.30262-4-dietmar.eggemann@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200427083709.30262-1-dietmar.eggemann@arm.com> References: <20200427083709.30262-1-dietmar.eggemann@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Capacity-aware SCHED_DEADLINE admission control needs rd (root domain) CPU capacity sum. The design of this function follows that of dl_bw_cpus(). That is, return the rd CPU capacity sum in case the rd span a subset of the cpu_active_mask. Compute the CPU capacity sum over rd span and cpu_active_mask when in hotplug. Signed-off-by: Dietmar Eggemann --- kernel/sched/deadline.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c index 4ae22bfc37ae..eb23e6921d94 100644 --- a/kernel/sched/deadline.c +++ b/kernel/sched/deadline.c @@ -69,6 +69,25 @@ 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; + + RCU_LOCKDEP_WARN(!rcu_read_lock_sched_held(), + "sched RCU must be held"); + + if (cpumask_subset(rd->span, cpu_active_mask)) + return rd->sum_cpu_capacity; + + cap = 0; + + for_each_cpu_and(i, rd->span, cpu_active_mask) + cap += capacity_orig_of(i); + + return cap; +} #else static inline struct dl_bw *dl_bw_of(int i) { @@ -79,6 +98,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 -- 2.17.1