Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1136975pxb; Wed, 6 Apr 2022 09:33:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx2B+biOHYLGJysP8MA3BEBSU8sw4QVdywg6sqMXICjpSTsj+bJLqYF/3Qzo4oWk6g+1Z9i X-Received: by 2002:a17:902:70c1:b0:154:667f:e361 with SMTP id l1-20020a17090270c100b00154667fe361mr9582691plt.148.1649262831392; Wed, 06 Apr 2022 09:33:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649262831; cv=none; d=google.com; s=arc-20160816; b=HEDT83G/9tt860ZOfT36peqf2u+45DNbE26jnvpUS2BcQUlp+nrGjDujMb67zZatEm ktNQKlf6z/AHSwOeZsLylvbWOGScPfRr3Hww6IlWG/6wkrlNbaKLgkQHzBSJ6Rrp3Vpn XlwtG4LgIHSHySfYWQ8c4OiLrqXGwM2b7wnjfdKUc5aQZ0ne7GZj8bla42DtyEzksfEX 8jbvUzR3PrGOgq2/KB4u0PStIVxAOdEAbxCpDeOSRCb21jWae5acD1L4AEPehL0JVf/N meJhzr7bRw0f3qGySmgaeNvaiIeIRi5UTAqB6UNRJTGh2WIHhGDPpSUJvEaj19mWyGUL 8QcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=BYXa8PFombRep9engE5rxdSOyyjwdVOdpF8aMt9fJa4=; b=j5u0JP/ptnkWKW/9dOue4VVQ261DE8f1JMhNg3O1IGPE3syjk93r/nkDd83PaS3yq8 hQ9vPtc0vMdjSnRsWFdSZ691l6QgMqD9xfzlJ0owq8CSxFkKMZiHay8Nc7JpLBatwCwQ /YfR7iyHgQbmihGjWQOvqsBfeF84b5+SROwUndczaPQnya8CG1orKV0nganZbYGcPvU2 jiUo/DQktT2JSY4JLkvg7WqKGES2cTV5Gi5gE0pmRLvUdOSfeWjD8taYHrbFQ54ft3Mq 16+E8+jDs3/T4U8aKgW7czNTqDohK6fibLLy0SPcaHWYAsnYAtpaHJ30TS3sy7tIlFCs GITQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=M59yDwO2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id e1-20020a056a0000c100b004fa3a8e00b1si14827853pfj.360.2022.04.06.09.33.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 09:33:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=M59yDwO2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E1B35299F10; Wed, 6 Apr 2022 08:41:49 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236198AbiDFPnO (ORCPT + 99 others); Wed, 6 Apr 2022 11:43:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236459AbiDFPmX (ORCPT ); Wed, 6 Apr 2022 11:42:23 -0400 Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 471A0383A31 for ; Wed, 6 Apr 2022 05:59:18 -0700 (PDT) Received: by mail-lf1-x12a.google.com with SMTP id k21so3964133lfe.4 for ; Wed, 06 Apr 2022 05:59:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=BYXa8PFombRep9engE5rxdSOyyjwdVOdpF8aMt9fJa4=; b=M59yDwO2o4yzklFtm1AMD2UQOlXvO3HNwryTxlWbl7F02YmLU8T5zlClxUwOc2LvWU mTtElYRwMaTfqO1YKDeXCg3rxMzLc+MnJYO0fd5NDA9oko+X+n1IcXHnWIxXhTayWSLK am2xSnSC1UAkXkUFu/IO2iBZKUEjC719BEFcq+JxjP0iJjn04b5tPrXsBhtvn/Po6RxZ qfjJiJQCkcfyiDANBAH1RxIp52GBWosM9qR78rDD6C33D/MkmSNb2JcBiLzPpTamqfyU L1jgRJnQ/5RBYofUF5ZuF0PLgUSNuEY0Jqb1NNrPYLSSivPFLTQU0VfaR+QNpd2dW9Xs NBtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=BYXa8PFombRep9engE5rxdSOyyjwdVOdpF8aMt9fJa4=; b=vhCoqKXH+dghoxd8u1I4jfLN1eaFfAggYJ/KEH4EZ19MWx5UuXU6DSQwTC0r/U5Sl7 7JlofAA943F8kU0cyLHa+Hqhe2IDXv1qJayJc8ZUiWrZM4qjRPTdD5lc2tHDkjZpO3yJ jsza4eDG+c8hXOxEGdX3vtBB10h6NwnD5SSmZ0G3zXyaorkpOmY2AtvowyHhek/0X6/M TbKlQpgCrG/i5jmLZsniC7zUFkIhMe4+3UlAu/EVboSqvZoVbcROgOk2/t9xfY8dZNin StX7ez51U8mI0Sx1loSSIo+xqxXnrnnkE0/iDL3rlkTD5e4zpZ8q/vRQ+h3rYNFh/KZO 9UUg== X-Gm-Message-State: AOAM531Q0xot2K/1MEQ1WeUCVHyZvp5L7ZMndFKtgwYSV9/jrCyXF4r7 aL7fAnRrmGUCsihi36/bdrVY2m3YUikNpNfHDxa56g== X-Received: by 2002:a05:6512:3f86:b0:44a:f5bf:ec9a with SMTP id x6-20020a0565123f8600b0044af5bfec9amr5958675lfa.490.1649249956530; Wed, 06 Apr 2022 05:59:16 -0700 (PDT) MIME-Version: 1.0 References: <1649244204-23471-1-git-send-email-zgpeng@tencent.com> In-Reply-To: <1649244204-23471-1-git-send-email-zgpeng@tencent.com> From: Vincent Guittot Date: Wed, 6 Apr 2022 14:59:05 +0200 Message-ID: Subject: Re: [PATCH] sched/fair: Return the busiest group only if imbalance is meaningful To: zgpeng Cc: mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, bristot@redhat.com, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE 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 Wed, 6 Apr 2022 at 13:23, zgpeng wrote: > > When calculate_imbalance function calculate the imbalance, it may > actually get a negative number. In this case, it is meaningless to We should not return a negative imbalance but I suppose this can happen when we are using the avg_load metrics to calculate imbalance. Have you faced a use case where imbalance is negative ? > return the so-called busiest group and continue to search for the > busiest cpu later. Therefore, only when the imbalance is greater > than 0 should return the busiest group, otherwise return NULL. > > Signed-off-by: zgpeng > Reviewed-by: Samuel Liao > --- > kernel/sched/fair.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c > index 601f8bd..9f75303 100644 > --- a/kernel/sched/fair.c > +++ b/kernel/sched/fair.c > @@ -9639,7 +9639,7 @@ static struct sched_group *find_busiest_group(struct lb_env *env) > force_balance: > /* Looks like there is an imbalance. Compute it */ > calculate_imbalance(env, &sds); > - return env->imbalance ? sds.busiest : NULL; > + return env->imbalance > 0 ? sds.busiest : NULL; > > out_balanced: > env->imbalance = 0; > -- > 2.9.5 >