Received: by 2002:ac0:da4c:0:0:0:0:0 with SMTP id a12csp637564imi; Thu, 21 Jul 2022 08:05:35 -0700 (PDT) X-Google-Smtp-Source: AGRyM1v6UvvzyxxuNgiOIPFqZjk73OnFw1dPZy7qhMYvKSwEGkkgOpsfWHM11ol2EqiN9Z37wJuM X-Received: by 2002:a81:47d6:0:b0:318:38b0:55e6 with SMTP id u205-20020a8147d6000000b0031838b055e6mr47924487ywa.89.1658415935233; Thu, 21 Jul 2022 08:05:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658415935; cv=none; d=google.com; s=arc-20160816; b=W3lQMo1z6IocJ4tylAB/kheLS8GyNbj8oOGTV/bVjsFRixByWrXbfZWPy1sdvBLT5Q XZFFywxOi5+af2w4twtIbJ8FfrVr26gs4lBU/byZc1Tx2BkTgNOIv6Dgvko/eFj0rBoq 0x/ebIE8GLGUCgIqhymXSsR7hIlc7J1byxP0zGN8O1qajVl1JiYKgZctWUVUMqq5gPHP l4+95HeWVzRQ8kYdSGq7lK41+Xhclugv8Z2bFut3tnZtIIaghJzWxylkBeTvaVUNTbNN Dm5BlLaq7FISUChZSyRidf33LFcRVqzqOa84McxbiCnIQzNlqB/03408dbnafkh5h8nf KXNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=N7XO6SZT6EufH3FJXLVFKDzZiMp5gD4qFPAGJnm16qU=; b=eNPRtEHchQZgSOG3Zcdv1LgUXUEuuArYs5GxoyWTXq/Po1dwEgmJTP4OD0cOiYxnMW OLg5dVcO6hiatWiVaoxKs3hmNdgxJfQZE5aUH4XVjJS8+T2+1YYFYDQ1RrqIQNShA3wP gUZTQdabaxVoPFQxdGBwNf3JU+YwHEMC+7KYhk5o7qGPxuKgNaVj7LhGQf0/Swu7HSBx S3tlz4QS6P5RNova6E+flOu4W1GyiZr8/JNuoqXm9Txad95PalaL2Hf8maw+cKgcK4G7 2Bdjb/xTZoY2HtdJdfLgc+BZ4ug3K86km/z4mvPUnBiN+MBD9YAPNLGhvFuVc8lK7Wab e2tg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i62-20020a252241000000b006708517fe30si1462909ybi.116.2022.07.21.08.05.18; Thu, 21 Jul 2022 08:05:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230328AbiGUOLK (ORCPT + 99 others); Thu, 21 Jul 2022 10:11:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230349AbiGUOLI (ORCPT ); Thu, 21 Jul 2022 10:11:08 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 94E8653D34 for ; Thu, 21 Jul 2022 07:11:07 -0700 (PDT) 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 D53191042; Thu, 21 Jul 2022 07:11:07 -0700 (PDT) Received: from wubuntu (unknown [10.57.86.173]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A601B3F73D; Thu, 21 Jul 2022 07:11:05 -0700 (PDT) Date: Thu, 21 Jul 2022 15:11:04 +0100 From: Qais Yousef To: Xuewen Yan Cc: Ingo Molnar , "Peter Zijlstra (Intel)" , Vincent Guittot , Dietmar Eggemann , linux-kernel@vger.kernel.org, Wei Wang , Jonathan JMChen , Hank Subject: Re: [PATCH 2/7] sched/uclamp: Make task_fits_capacity() use util_fits_cpu() Message-ID: <20220721141104.3d4ohdyxxlqyttle@wubuntu> References: <20220629194632.1117723-1-qais.yousef@arm.com> <20220629194632.1117723-3-qais.yousef@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07/20/22 15:23, Xuewen Yan wrote: > On Thu, Jun 30, 2022 at 3:48 AM Qais Yousef wrote: > > > > So that the new uclamp rules in regard to migration margin and capacity > > pressure are taken into account correctly. > > > > To cater for update_sg_wakeup_stats() user, we add new > > {min,max}_capacity_cpu to struct sched_group_capacity since > > util_fits_cpu() takes the cpu rather than capacity as an argument. > > > > This includes updating capacity_greater() definition to take cpu as an > > argument instead of capacity. > > > > Fixes: a7008c07a568 ("sched/fair: Make task_fits_capacity() consider uclamp restrictions") > > Signed-off-by: Qais Yousef > > --- > > kernel/sched/fair.c | 67 ++++++++++++++++++++++++++--------------- > > kernel/sched/sched.h | 13 ++++++-- > > kernel/sched/topology.c | 18 ++++++----- > > 3 files changed, 64 insertions(+), 34 deletions(-) > > > > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c > > index 5eecae32a0f6..313437bea5a2 100644 > > --- a/kernel/sched/fair.c > > +++ b/kernel/sched/fair.c > > @@ -160,7 +160,7 @@ int __weak arch_asym_cpu_priority(int cpu) > > * > > * (default: ~5%) > > */ > > -#define capacity_greater(cap1, cap2) ((cap1) * 1024 > (cap2) * 1078) > > +#define capacity_greater(cpu1, cpu2) ((capacity_of(cpu1)) * 1024 > (capacity_of(cpu2)) * 1078) > > #endif > > > > #ifdef CONFIG_CFS_BANDWIDTH > > @@ -4317,10 +4317,12 @@ static inline int util_fits_cpu(unsigned long util, > > return fits; > > } > > > > -static inline int task_fits_capacity(struct task_struct *p, > > - unsigned long capacity) > > +static inline int task_fits_cpu(struct task_struct *p, int cpu) > > { > > - return fits_capacity(uclamp_task_util(p), capacity); > > + unsigned long uclamp_min = uclamp_eff_value(p, UCLAMP_MIN); > > + unsigned long uclamp_max = uclamp_eff_value(p, UCLAMP_MAX); > > + unsigned long util = task_util_est(p); > > + return util_fits_cpu(util, uclamp_min, uclamp_max, cpu); > > } > > May we should consider the CONFIG_UCLAMP_TASK... The uclamp functions are protected with CONFIG_UCLAMP_TASK and should result in dummy implementation and dead code to be compiled out. It avoids sprinkling ifdefs all over the place this way. Cheers -- Qais Yousef