Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1102991pxb; Wed, 6 Apr 2022 08:47:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzhBiNNjd41YjpdciVJkYoihVj0FoJDqtiCfWob+ychX0h/WBqPqSzXCkH1OiSyExoATF1O X-Received: by 2002:aa7:81c6:0:b0:4fa:70a2:2063 with SMTP id c6-20020aa781c6000000b004fa70a22063mr9376106pfn.71.1649260068990; Wed, 06 Apr 2022 08:47:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649260068; cv=none; d=google.com; s=arc-20160816; b=F+4aFiyQ0v68ccFsJ4GOXpX440vAVAWydL7vWMOzR5JtoKE0XlTycllOyGxvwI45Cd XosVTkzhBtNCUfQtUX0tRs494jV9Uoy7hW4yGcZ3ETbyFFUBRHMx6GCMzbRI+M6dzLk6 +fQEX+RUDYXiPWSUkaoByHUDnD6v2tvvliRQXNfKHrHbDFuz6aGofaC9b5jAvvraI0Rj 7WOU8sN6TYNFfodzu4d5gC+vnuCGhkDjOvTbJmWsO4okxI0Oo4I1zuGKc8r0dZIHEAho aqrVItZoB+oNvyKZ/AGR4PCiMKvgO+t1r8p1TFMkpwak/C25GFfYp+1MoGpTMr44xY6n RQlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:to:from:dkim-signature; bh=hWie3mJTAnfpzOXhn4Z/4uIgwysiFcrooHT60DVzybQ=; b=aGHCw64i2K1+/KCp01AiDIL39+gVPyGMQ53Ua0AqgILZt5L4UM2SPTQ06NRtX7aS8k E57u5jTEUii2D3kdUx663y8e2O2coQIJMy8DF/3KFVuKCsSriTtphDODuQtOhXGRoqKp Ctsm+81OIAvRd29e0eJ5NswPFHXWU8W3J9a7QpIKc5pclkRzNbH4g5hbmNMUYymqRbqZ +NPkAaLb/hdjH9/psaXtiz2SBp7XyzohPPEFv6UYCzO9l4vdMw2Uy3OeHrhdsVGGMk0r Ct9e0lEJ94UtR8EBNGqFpqWmaQiFgCrJImzqdKs08e9eYTHRWNORmdm7nENwoPLYSi57 AsXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=CE9K9MT+; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id e18-20020a17090301d200b00156a2cedc85si10017103plh.528.2022.04.06.08.47.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 08:47:48 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=CE9K9MT+; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8D30F2487A6; Wed, 6 Apr 2022 08:01:54 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235282AbiDFPDs (ORCPT + 99 others); Wed, 6 Apr 2022 11:03:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235328AbiDFPC1 (ORCPT ); Wed, 6 Apr 2022 11:02:27 -0400 Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 509F6AAB5B for ; Wed, 6 Apr 2022 04:46:41 -0700 (PDT) Received: by mail-pl1-x62e.google.com with SMTP id n18so1723067plg.5 for ; Wed, 06 Apr 2022 04:46:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id; bh=hWie3mJTAnfpzOXhn4Z/4uIgwysiFcrooHT60DVzybQ=; b=CE9K9MT+Rt2kpApicMQngJo7nwda7ou2DtrFamdUZFxlh3kP15ZFuCURNlqhkQmCGY 2AT2p7oDzXmGjNJgBhxofiTlVwbGL2bESAobC4pPZiIEqg605SXXcDgFou2T6Acy3uno QJnZeOHUhwImxP4AKwaD8eEC9R8AntNoAFKgRLD+1PiQikFBcA9KHKWkZ6x8RBW71ddk xQpQaYU+zmm7wYRMe0eufz5huUYwBj5SjrudLWccRPZbmsG2S3Rjahtutr9ZdVYLEvHi ectsA3dd8F3ivzbXM0WBgO0uM3BnScI145ZmiaJQMxHhcubB6TcTzGgRh4Yh5+26x18B Ngdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id; bh=hWie3mJTAnfpzOXhn4Z/4uIgwysiFcrooHT60DVzybQ=; b=A1Q+IloOcKOt2ZPOxXCMvFolA+uygHHTsMnZh3M358jUwPZ3M8kajgpqjsvziiKS64 mCYsraTStAdveNJjYktr+hJnYel64dy8O3eK3JZB3rkIhQZzE7W4VVexJRS7eRXQTWz3 mNFoVMQBfKterKIKfHOoht5tLKVqJIvkstrSTYDD22jraw3+qJwty999A7BrDmJvvoqQ 7A/8Sf1EquAn6/I8dIdoJOjS/n3tTAaWrKqJn9BFRSSb+jwYltcj8rAOnfCXxb312TJw Zxu3LxR9MkK2/rC9i2/NDgOJv3NejRI3HF1wFQmI6QXHA0rb/Vzd6tf4bG7j3pss6LZH 0uWg== X-Gm-Message-State: AOAM531txUZ9p3OfgtiRaemFICciSHko4ZskLz4Jq+6Ms+GAskIgLa+k XvZp7gGPfc9/2wh0tIYAYoY= X-Received: by 2002:a17:902:c40e:b0:154:80a7:95c9 with SMTP id k14-20020a170902c40e00b0015480a795c9mr8546529plk.28.1649245585441; Wed, 06 Apr 2022 04:46:25 -0700 (PDT) Received: from localhost.localdomain ([150.109.127.35]) by smtp.gmail.com with ESMTPSA id br2-20020a17090b0f0200b001caa0db90d3sm5578684pjb.13.2022.04.06.04.46.23 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 06 Apr 2022 04:46:24 -0700 (PDT) From: zgpeng X-Google-Original-From: zgpeng To: mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, bristot@redhat.com, linux-kernel@vger.kernel.org Subject: [PATCH] sched/fair: Simplify the scene where both local and busiest are group_fully_busy Date: Wed, 6 Apr 2022 19:46:20 +0800 Message-Id: <1649245580-27256-1-git-send-email-zgpeng@tencent.com> X-Mailer: git-send-email 2.7.4 X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, 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 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; + + 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