Received: by 2002:a25:1104:0:0:0:0:0 with SMTP id 4csp344108ybr; Fri, 22 May 2020 08:00:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy01gse4pswLWHKojxl5Ag/68Rc8D2s90Gr0McXuOAD1u3YNnR99qLC/FmHdlQM3v4kGUb9 X-Received: by 2002:a17:906:fb15:: with SMTP id lz21mr8249621ejb.538.1590159614427; Fri, 22 May 2020 08:00:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590159614; cv=none; d=google.com; s=arc-20160816; b=Fofz9JOJ9PNYwauM4rTM57hLmsUFJPWEBYdhZstenFddv5UTRsQQ7NkwrWX2opbN+Y Yl7nfjlctcFisMryyS2I0LfqPeb++NEFORWv/S3mtLNy9bHbxsRQdrBQ91DBRAMSAbzz IRE24JlaJ8G+x+vC4xN4XOvv/a+rXqKm0XWVWFroM6tMNTTm31j+NP36x0I33jlLY9bt nsH94I1tMdRhrUumrJZfkIkfdXwKcvR0gxDw+FtzWUEIMTTau8YjM5aTQZE+5iJ1FqLe 377z25xz9I4AN/i5/zVs7FOF5NH/Xywx7qqePX2wStHfdJ/2aMmm124lM5e4W0VU1rzg J5cQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=iH5yVdy61YIiERwmNvp4WQdgMphPo686FYjJ6kiL4ZA=; b=vBnOvwtzYoGsbprCU4Nw7fIGzumvT9K/WpuRG6UnpNrM9keVwfbH3AdPBEkiG32DS+ etsVpWop4dMGT5kY+FhRX0FUvg3y67nHgdGB6+F9uLvuoRjSGoJOQYVB9/uk3Gf6eRT8 /7WR1bDhhVZox0vbF5XSkMK3GxLksFIU0bMIcMARnF1z/ZcTSP4EZck1XIrogFF404qE Sab4t98pXAz9Cg3Xy+IJcgSLbIdz7nkucdtOiZlC9S+kaCoTvOEyGuF+JxyNopkeoBLe 8u+sW8yd69nEFEF/lCzHU5nQ3NfjrTZh9+vWPJLI/8xp3al2z2IkRIsQgof5eaDjFf3k 54XA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Qavi8gxF; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z13si5475015ejl.473.2020.05.22.07.59.51; Fri, 22 May 2020 08:00:14 -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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Qavi8gxF; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730734AbgEVO6N (ORCPT + 99 others); Fri, 22 May 2020 10:58:13 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:50627 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730699AbgEVO6K (ORCPT ); Fri, 22 May 2020 10:58:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1590159487; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=iH5yVdy61YIiERwmNvp4WQdgMphPo686FYjJ6kiL4ZA=; b=Qavi8gxFgMxdw4CYkqhoX6BzBiAQoYYgHKu0iQdB76mld0t8aXh+VEXbEkmQ43z7aFeNvb IdoSrAG6Pmg3IKFFyxANnVdYvO0a+mdjfEcu2915HzM0V75SCB3Rjb7qIn5MHxuxwgDwju /6EDyIn7JnR2UlZGQ78qhYC1Aeb3KgE= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-435-vYfV2lUpP6-oGK-i_XgiHg-1; Fri, 22 May 2020 10:58:06 -0400 X-MC-Unique: vYfV2lUpP6-oGK-i_XgiHg-1 Received: by mail-wm1-f71.google.com with SMTP id f9so4208325wml.9 for ; Fri, 22 May 2020 07:58:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=iH5yVdy61YIiERwmNvp4WQdgMphPo686FYjJ6kiL4ZA=; b=CWDp3U+5ca/zcTe1/kCmwJjR7MadBX+ikvzXhSGtLpErbciwuNHZTAsWtVLCVHCKKn IST96qnfoFyckgQ4gYTKZPAvcWgrrCZLwAlG7chKqHbUeuMkgiO1BSOq2Iitm6fn5Tpo WLxwyGFENyUxhAv9q3WMO5g6Z+mEzT9gZ5s5O3oJIuEnd8ArSgB7FWg8GVeKiRNwkCyK yUYkBewy6qUrS5LVMh/zrsZKT1H3A2SIjTrP3e9P/iy2v12yD/28qepY2L8vqmH/1/w7 lZoUenTCw6/F7sMwZSBGktPOUpfuM19Lg6veqPA1ratkqXCCXvhA6aSgUp7YAqa2ga3F 4sPA== X-Gm-Message-State: AOAM533ZLJBOmlMoBNACLhJKRjlbk/PH3ZhuYaANnhleYptY1ZUPFIft tccweA11gGlRdNL0/rPNOgm7DAsAlygRWOnjjTxECg1luEWtcPSp4cdcYb99FI0JIjACvVQPdWI ix8M2dKWBeIxwztQ8Dt8LPe++ X-Received: by 2002:adf:f1c3:: with SMTP id z3mr4026778wro.201.1590159485111; Fri, 22 May 2020 07:58:05 -0700 (PDT) X-Received: by 2002:adf:f1c3:: with SMTP id z3mr4026753wro.201.1590159484884; Fri, 22 May 2020 07:58:04 -0700 (PDT) Received: from localhost.localdomain ([151.29.176.125]) by smtp.gmail.com with ESMTPSA id v24sm10259172wmh.45.2020.05.22.07.58.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 May 2020 07:58:04 -0700 (PDT) Date: Fri, 22 May 2020 16:58:02 +0200 From: Juri Lelli To: Dietmar Eggemann Cc: Ingo Molnar , Peter Zijlstra , 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: Re: [PATCH v3 2/5] sched/deadline: Add dl_bw_capacity() Message-ID: <20200522145802.GC600689@localhost.localdomain> References: <20200520134243.19352-1-dietmar.eggemann@arm.com> <20200520134243.19352-3-dietmar.eggemann@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200520134243.19352-3-dietmar.eggemann@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 20/05/20 15:42, Dietmar Eggemann wrote: > 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 > --- > kernel/sched/deadline.c | 33 +++++++++++++++++++++++++++++++++ > 1 file changed, 33 insertions(+) > > diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c > index 4ae22bfc37ae..ea7282ce484c 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 > -- Acked-by: Juri Lelli