Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp492591rwb; Wed, 16 Nov 2022 03:51:54 -0800 (PST) X-Google-Smtp-Source: AA0mqf4qWuZctsFMyWIzXID6Kfjk8lZbL6Il3urBP5ZY1hZlumegPu903INxFtYLdC2NAk464OWN X-Received: by 2002:a17:902:9a01:b0:172:9db6:3c5 with SMTP id v1-20020a1709029a0100b001729db603c5mr8665479plp.110.1668599513916; Wed, 16 Nov 2022 03:51:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668599513; cv=none; d=google.com; s=arc-20160816; b=G+Pyqkv2+lP1OMsr9Whbj/oTN06zlX7ayUYvIkUK53aA/ZMmPPSB7c5OOYb7Z4a2CV cR0QT8Z8ocNphokx8JG3OiTcRvM+vDQ3mf7DbDN7djVTGA+ql8K88CV3AIkeoe9jfjxP knFIqMt9+6KrZcCplx8bzw4sJZsXsM6Vp35GbqC9buU45sxolH3JVVwuvMn9nVuhbaFe TRlNSulLyKnPrTApHZ18A8zqbhqEfMOsNzhV224AjzJXtnfQab3jhznYRPQ1swQrB/Zj Us9wOURR0LEoYV9BFWhtn4Q6CQYR7jaqs/4J26keMg1sS7RPLj6pAJqRfWnuY3rVPX39 Zc+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :content-language:cc:to:subject:user-agent:mime-version:date :message-id; bh=Ndr3/s9x85iG8b7qwgrhJGa+eUZ2MI3HTDXkqHo8iEg=; b=S9GQX/N2AapNLVik0WQjKGTF184toPvwQIL+3liG9B/zXp487KB49jMadrhZKdmDme Eyjf6+DkHd9EfHH+iqSlAaVA1HNcIxPYdYVVdUdzwmsH/crszmH3Omxs8UYlzBy66YKW lY9L6blX1jtMWcpz2sb00pYqQlemetW8GmxMho6W851ZloRkeS6/c1+ZQV8f+a9hJ2hL m2VqfVY8NrgVCN3GsvXKfM4cQnDRXuoHJ8VwqWy/IhqtSpKHzfw9j5FKWCI+bKT/S1HC dhYWYOelNExyEi4icibe6lR3gRuRMKTSD0v8G6Xos1BS/zgWToTYhH5pE3uWVDmPf+RP N3yA== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k5-20020a63ff05000000b0046b03475683si14397446pgi.831.2022.11.16.03.51.42; Wed, 16 Nov 2022 03:51:53 -0800 (PST) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233056AbiKPL1i (ORCPT + 91 others); Wed, 16 Nov 2022 06:27:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231231AbiKPL0Q (ORCPT ); Wed, 16 Nov 2022 06:26:16 -0500 Received: from mx6.didiglobal.com (mx6.didiglobal.com [111.202.70.123]) by lindbergh.monkeyblade.net (Postfix) with SMTP id B007E25EA3 for ; Wed, 16 Nov 2022 03:17:26 -0800 (PST) Received: from mail.didiglobal.com (unknown [10.79.64.13]) by mx6.didiglobal.com (Maildata Gateway V2.8) with ESMTPS id BAD6D110243209; Wed, 16 Nov 2022 19:17:24 +0800 (CST) Received: from [172.24.140.14] (10.79.64.101) by ZJY01-ACTMBX-03.didichuxing.com (10.79.64.13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.17; Wed, 16 Nov 2022 19:17:24 +0800 Message-ID: <58020f64-fbbc-fdc7-2cbc-a2aa40062d74@didichuxing.com> Date: Wed, 16 Nov 2022 19:17:18 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.3.2 Subject: Re: [PATCH] sched/core: use correct cpu_capacity in wake_affine_weight() To: Vincent Guittot , Honglei Wang CC: Ingo Molnar , Peter Zijlstra , Juri Lelli , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider , Content-Language: en-US X-MD-Sfrom: wanghonglei@didiglobal.com X-MD-SrcIP: 10.79.64.13 From: Honglei Wang In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.79.64.101] X-ClientProxiedBy: ZJY03-PUBMBX-01.didichuxing.com (10.79.71.12) To ZJY01-ACTMBX-03.didichuxing.com (10.79.64.13) X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,SPF_HELO_NONE,SPF_PASS autolearn=no 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 2022/11/16 19:00, Vincent Guittot wrote: > On Wed, 16 Nov 2022 at 10:12, Honglei Wang wrote: >> >> It seems make more sense to do the load weight calculation with >> respective cpu_capacity. >> >> Signed-off-by: Honglei Wang >> --- >> kernel/sched/fair.c | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c >> index e4a0b8bd941c..a9f75040969b 100644 >> --- a/kernel/sched/fair.c >> +++ b/kernel/sched/fair.c >> @@ -6262,13 +6262,13 @@ wake_affine_weight(struct sched_domain *sd, struct task_struct *p, >> this_eff_load += task_load; >> if (sched_feat(WA_BIAS)) >> this_eff_load *= 100; >> - this_eff_load *= capacity_of(prev_cpu); >> + this_eff_load *= capacity_of(this_cpu); >> >> prev_eff_load = cpu_load(cpu_rq(prev_cpu)); >> prev_eff_load -= task_load; >> if (sched_feat(WA_BIAS)) >> prev_eff_load *= 100 + (sd->imbalance_pct - 100) / 2; >> - prev_eff_load *= capacity_of(this_cpu); >> + prev_eff_load *= capacity_of(prev_cpu); > > we want to test : > (cpu_load(this_rq) + task_h_load(p) ) / capacity_of(this_cpu) < > cpu_load(prev_rq) / capacity_of(prev_cpu) > > but instead of doing expensive division, we do the below which gives > the same result > (cpu_load(this_rq) + task_h_load(p) ) * capacity_of(prev_cpu) < > cpu_load(prev_rq) * capacity_of(this_cpu) > > ha, I misunderstand the strategy, thanks for coaching, Vincent. >> >> /* >> * If sync, adjust the weight of prev_eff_load such that if >> -- >> 2.14.1 >>