Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1180221pxb; Wed, 6 Apr 2022 10:37:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwfFd1i1wOAVE0KE5Qp+anOzd7xkhZNKGZvQ0slZOrc3EOaVZxuFZM65w6ZCQTyHWLahfVE X-Received: by 2002:a17:902:7297:b0:156:46bc:4b7 with SMTP id d23-20020a170902729700b0015646bc04b7mr9837512pll.77.1649266649705; Wed, 06 Apr 2022 10:37:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649266649; cv=none; d=google.com; s=arc-20160816; b=ak9Dmp9AIq0+Ml+UXaxM2fYt6/1d5GCoC+GOscVUcw4rDQf+IplOpbPbmzKb1+fqvF bbDsHBHRKaGgNPrDEN2EhFjR25YjFEqSICEEQttQXHAQXU/Uhc3FtCc2jNzyJ37yvGv2 AZn4x/iPifuq00JGS+ivFeSsbVT3/SSjea+bQXl7eUCRtxxShYiauP53/AavoNzp1GOr kSimWQnPqgo8CzVqtVjRIwA1ADQw4cwEUMDHrIT/BoVhBoY4bGzjTzaq9TjpaAAawyVg kTbdTkd8PjnQ6bwtrCJXVjbMd28ka2TysAqKBmkmey7ZY7QlN870f22KbnV9vxcIUpVR 1R3w== 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=WIVsdQsPt2lxmnjdpo863Zg6K+OImetGpesYpOQLQrY=; b=MK7KcTxPv7gxq3egGB6RuGkuC+QdWjZk9E/7qq2fWp93cgAZpmptA33gNamscSpVFC 98xqnDxv5m6ZKzl41GAfz9HNHKCtP4KSSj4B5OxAR8Cl+hVBZzQATRl7FplFfGewsU1T 95ygGnKJXDti2uh3IXw37FeLbonFU7FQVgLMeet8Dgv2M6JBlzvt4rIq7iyuIJgHbSn2 E2wZ2BgQWHV/6gZT9g67Yl1yP/L5iesNB95IruskCXUa47eGGRsBfjI8uxZxAJvAW1+6 UJA/bHme6J6ODFEaNL5Mm4BKaG1pbK/aWc5eqhQEV052VI5idohjAT9sjia4n+rTtMPB eglA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=miXKVMm0; 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 ay7-20020a056a00300700b004fa3a8e004csi16208923pfb.259.2022.04.06.10.37.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 10:37:29 -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=miXKVMm0; 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 42C0A217C5A; Wed, 6 Apr 2022 10:33:20 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239286AbiDFRfM (ORCPT + 99 others); Wed, 6 Apr 2022 13:35:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239174AbiDFRex (ORCPT ); Wed, 6 Apr 2022 13:34:53 -0400 Received: from mail-lf1-x12b.google.com (mail-lf1-x12b.google.com [IPv6:2a00:1450:4864:20::12b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A4EF1F6BE7 for ; Wed, 6 Apr 2022 08:41:54 -0700 (PDT) Received: by mail-lf1-x12b.google.com with SMTP id d5so4758454lfj.9 for ; Wed, 06 Apr 2022 08:41:54 -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=WIVsdQsPt2lxmnjdpo863Zg6K+OImetGpesYpOQLQrY=; b=miXKVMm0bdpNo8et8CZm7eD33XHm+hRGYT5aUy/TjlYtIbm8+mQgqEB71S4VfHGLU5 4BrZqQae+7jH7cSgOVqtH4rAJA6AtEycG5yWt/1K8hOBGtWcv6af58Fny759ak3zTWcx st/uFU6mUpXZ2yldbatFSNSGeQbjjuTWR7uNA/JWuxH0U3ZM5xD1KodgyJTd4koONW53 QTzflRlgvGq0UaFb4ufnA6wOAUW0aqelgom78FQOXlMjNsKK11QbYgD3VxAvw9D7SCgW sPBeiuza/3cB9IstHe+dlqqOjawFexBxrJDnSJSqCaggD9GQX/PTm4RkKjVmc8CgP2FM z5xg== 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=WIVsdQsPt2lxmnjdpo863Zg6K+OImetGpesYpOQLQrY=; b=lJImb9Y7keCmJA9AtZLi5MdHEUApArS0JxOmvAmWukjbSL0kJThL0SYVhTXZ2M/3HD 3LjZeObT3Ek6ze0m2Scjh6HbgixRH3GwIqq9ypNSlwlPG/n4rlBP2A7AobV3u5+dFaMo 12qKBeu2D7tufmTIM60wgPqhcm/Xx/12qrdn1AQDCaAfFKVUkWdonUfvLnPg8iYd+vko yuol39iyNOfmyOrT6RFBMSXvtzbRHm8qLw8goWxo9l6Mo/VbvUg+Pqr9re8WffP9Iy9t g/CxYshaljnPM0HR24R7bJbhgU1it2lJctMXReVYGIaoy++XwxxbEkJrMtSg1oiJ8zCr Hiwg== X-Gm-Message-State: AOAM533/LtOsOyya+c+2cJNfri8BMOuXQTTs52V7hgbO9LmCwaRCBs5j RBwcOyiA4NBE2HKCYhX9c0aVGgjFfQ70IVGqkbovPA== X-Received: by 2002:a05:6512:250:b0:44a:47c6:96a7 with SMTP id b16-20020a056512025000b0044a47c696a7mr6136832lfo.46.1649259712451; Wed, 06 Apr 2022 08:41:52 -0700 (PDT) MIME-Version: 1.0 References: <1649245580-27256-1-git-send-email-zgpeng@tencent.com> In-Reply-To: <1649245580-27256-1-git-send-email-zgpeng@tencent.com> From: Vincent Guittot Date: Wed, 6 Apr 2022 17:41:41 +0200 Message-ID: Subject: Re: [PATCH] sched/fair: Simplify the scene where both local and busiest are group_fully_busy 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:46, zgpeng wrote: > > When both local and busiest group are group_fully_busy type, because > the avg_load of the group of type group_fully_busy is not calculated, the > avg_load value is equal to 0. In this case, load balancing will not actually > done, because after a series of calculations in the calculate_imbalance, it > will be considered that load balance is not required. Therefore,it is not > necessary to enter calculate_imbalance to do some useless work. > > Signed-off-by: zgpeng > Reviewed-by: Samuel Liao > --- > kernel/sched/fair.c | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c > index 9f75303..cc1d6c4 100644 > --- a/kernel/sched/fair.c > +++ b/kernel/sched/fair.c > @@ -9634,6 +9634,18 @@ static struct sched_group *find_busiest_group(struct lb_env *env) > * busiest doesn't have any tasks waiting to run > */ > goto out_balanced; > + We are there because both local and busiest are not overloaded, local is idle or newly_idle and there might be an opportunity to pull a waiting task on local to use this local cpu. I wonder if we should not cover this opportunity in calculate_imbalance instead of skipping it > + if (local->group_type == group_fully_busy) > + /* > + * If local group is group_fully_busy, the code goes here, > + * the type of busiest group must also be group_fully_busy. > + * Because the avg_load of the group_fully_busy type is not > + * calculated at present, it is actually equal to 0. In this > + * scenario, load balance is not performed. therefore, it can > + * be returned directly here, and there is no need to do some > + * useless work in calculate_imbalance. > + */ > + goto out_balanced; > } > > force_balance: > -- > 2.9.5 >