Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp2649477ybz; Mon, 27 Apr 2020 01:39:23 -0700 (PDT) X-Google-Smtp-Source: APiQypK2In8bdnBGZ1r7aYteckKwY+zEnqG986ZR50b4MCMJC+2D7NjR4ZyhkVmiJkQzefBeFVsv X-Received: by 2002:a05:6402:1b0b:: with SMTP id by11mr17300248edb.269.1587976763381; Mon, 27 Apr 2020 01:39:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587976763; cv=none; d=google.com; s=arc-20160816; b=xZW/93rwWt0twBkFwm2bewPCY+SH6quEcAL6iH3kqG1sN4YkCVF/9SC2DB/LW0b/Jd KzH61xiEALYhSYcPcByHJ5x6HXGvbPviMGFW6ii1L+ps+5R3RdwFd8y2bSvUwY78YOwd 9hy+oneKCGQTYrNJMdDHsQRxMpiSdZUdONf0fBhbnjDctsUg1I3D6njz0aM6sS/RQ3fW /g52NrOLKqdUaSjsxJkJ/9vsEtTN8RSghhV/R3a6xY0xxZ9HZJn1sDHhghWRQLVSXZxQ tA57HHsoL3Sth0usYaf+C4kklvQprPVPe7YFVzuDbH08nAvatsnYvCPM9vrHyaE5mnRv 7gTg== 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=OgUqypgeh4kJdAZ32d8JkWlZjn2dSdcUjISVS3Tf83E=; b=PBOiW9nzQq5m2qVZSmHS4G04VaDRDQSSnHj9zIpGUxH2c9GGXzEu1JAeqOVwK2VScm w3f9ObRpt6IGs3DIdE3pcULo4nail/joUR59K9dSIrbFFVRoK1a8IrlW8ZmPQS3ikj26 CVtkYqvvNkunmCdsu7vSYUk7xAkSQPT+pB+DZ9MTAjc+diRs32Vd8xjJaglXb1yp4AFe 54MI8Vhx6KuArVtL9BNtpY4n2Jb41q1bL5olxAAkeX2HGq3GLsjZ50XWIOm8xHcXfVhu 2QPVZaEIlat6/RM9p+DqAfamaJiBdudoKxTx4tSNyEX5YsRXRoSpB7SK5OV8jb/v+a3i GswQ== 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 h2si7317748edz.585.2020.04.27.01.39.00; Mon, 27 Apr 2020 01:39:23 -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 S1726779AbgD0Ihg (ORCPT + 99 others); Mon, 27 Apr 2020 04:37:36 -0400 Received: from foss.arm.com ([217.140.110.172]:59878 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725899AbgD0Ihf (ORCPT ); Mon, 27 Apr 2020 04:37:35 -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 097CE1063; Mon, 27 Apr 2020 01:37:35 -0700 (PDT) Received: from dell3630.arm.com (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 6D6E13F68F; Mon, 27 Apr 2020 01:37:31 -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 1/6] sched/topology: Store root domain CPU capacity sum Date: Mon, 27 Apr 2020 10:37:04 +0200 Message-Id: <20200427083709.30262-2-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 Add sum of (original) CPU capacity of all member CPUs to root domain. This is needed for capacity-aware SCHED_DEADLINE admission control. Signed-off-by: Dietmar Eggemann --- kernel/sched/sched.h | 1 + kernel/sched/topology.c | 15 +++++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index db3a57675ccf..58e1d3903ab9 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -803,6 +803,7 @@ struct root_domain { cpumask_var_t rto_mask; struct cpupri cpupri; + unsigned long sum_cpu_capacity; unsigned long max_cpu_capacity; /* diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c index 8344757bba6e..fbb20b7a80c0 100644 --- a/kernel/sched/topology.c +++ b/kernel/sched/topology.c @@ -2052,12 +2052,18 @@ build_sched_domains(const struct cpumask *cpu_map, struct sched_domain_attr *att /* Attach the domains */ rcu_read_lock(); for_each_cpu(i, cpu_map) { + unsigned long cap; + rq = cpu_rq(i); sd = *per_cpu_ptr(d.sd, i); + cap = rq->cpu_capacity_orig; /* Use READ_ONCE()/WRITE_ONCE() to avoid load/store tearing: */ - if (rq->cpu_capacity_orig > READ_ONCE(d.rd->max_cpu_capacity)) - WRITE_ONCE(d.rd->max_cpu_capacity, rq->cpu_capacity_orig); + if (cap > READ_ONCE(d.rd->max_cpu_capacity)) + WRITE_ONCE(d.rd->max_cpu_capacity, cap); + + WRITE_ONCE(d.rd->sum_cpu_capacity, + READ_ONCE(d.rd->sum_cpu_capacity) + cap); cpu_attach_domain(sd, d.rd, i); } @@ -2067,8 +2073,9 @@ build_sched_domains(const struct cpumask *cpu_map, struct sched_domain_attr *att static_branch_inc_cpuslocked(&sched_asym_cpucapacity); if (rq && sched_debug_enabled) { - pr_info("root domain span: %*pbl (max cpu_capacity = %lu)\n", - cpumask_pr_args(cpu_map), rq->rd->max_cpu_capacity); + pr_info("root domain span: %*pbl (capacity = %lu max cpu_capacity = %lu)\n", + cpumask_pr_args(cpu_map), rq->rd->sum_cpu_capacity, + rq->rd->max_cpu_capacity); } ret = 0; -- 2.17.1