Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1170514pxb; Wed, 6 Apr 2022 10:22:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz0La3SnToM/GCeevj1GbqtalZfPi5qhSixoH8Q5WiX7gGc8LzYypDEn+mBdQ5ZsLHahC2a X-Received: by 2002:a17:903:2346:b0:156:9956:f437 with SMTP id c6-20020a170903234600b001569956f437mr9916783plh.123.1649265768237; Wed, 06 Apr 2022 10:22:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649265768; cv=none; d=google.com; s=arc-20160816; b=IeCmsPxXdf9uIIZRcsy9v0RBls7VR7kMU4qHreRAVd6wtdibKRoqMjJdjfF8MWu5tn SVzuFGRO/gI+QUgk5/k4q5Erso7nqcJWtwnVj94xUTkf3wGqf2N/cGlvnTNFv746388D kUbbgetk/RU/gQLZ9moPbS8qYlEyjf9w4UsWsSXIrzlNhDTkBSHPW18irltTcdpbTrQN XOXORpEYrtjG0OFZ+yDvj4qwNb9LoDME5DXJGQBBSah2Pr9IF/b5Aqs0dMG3dDUo8KyF 0+71lTEYueIGecK/YTMpgJJYu3r4ZS+ANz3ogQ6MiZvYcquOFhWkh3+JD3df69ou2ARl DXqQ== 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=uTfG28cRodiq/+2LJPZqP5fNSiZIDmn4jveiK6bxlps=; b=F+MgkDUCXI+GKBRAXwPEPCE8HZn7c37Zp+Wcyf5FMoyVBmx5nUH0sy02aHJdfwXqtV vBxRpXtOeWs8AWs2eDnPG7B+ii/w+/7TmK6lJ/71eSXSJP0nbKVGWHl1jHFy1Sy3vqCf JXOYGJTukXZLCPG9WjdlVy7VnbjfT87b5/7Q2DW9kqeV0MSPSmlOwit03zC2lMi9nYAk F+OqyCibgfdadQviDoilG1BK4LtLLRT0KFvKlKwVoGELtqlp27h8H5nHepRUWFDqeuat Olxo0ZcJRYQgoNsm/f46ker4POAF6/P9jf+IYje4Po87Dqub2x2vMxRj8wRZ3x02Oksx SyvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XI8nDaN0; 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=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id i26-20020a63541a000000b0038206e0017esi16651426pgb.558.2022.04.06.10.22.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 10:22: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=@linaro.org header.s=google header.b=XI8nDaN0; 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=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 9CEF3287A17; Wed, 6 Apr 2022 10:22:20 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238894AbiDFRXp (ORCPT + 99 others); Wed, 6 Apr 2022 13:23:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51638 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239499AbiDFRXC (ORCPT ); Wed, 6 Apr 2022 13:23:02 -0400 Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [IPv6:2a00:1450:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 502AF140DF3 for ; Wed, 6 Apr 2022 08:22:13 -0700 (PDT) Received: by mail-lf1-x12e.google.com with SMTP id t25so4678055lfg.7 for ; Wed, 06 Apr 2022 08:22:13 -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=uTfG28cRodiq/+2LJPZqP5fNSiZIDmn4jveiK6bxlps=; b=XI8nDaN0YTRRNOuuWDmD8ZTIYZbINFcKXcZ1ur9Xcei88v3/EKSmM8tCwJMOQ3TfmC RyeuZDtXfUgVT55tcrcFqV3NaqcLriA2zG0gxqu+y7xA9c1+M3ZfRdh+SozpG5YadYWX +05bbdM9jD1n3FYWXPjTNyFW2xjzqT+etMHWvHo60SOBQ85ceGIF1aT6EChLR0EPZjVi hwnMsa00bl0U5Ar0ZNXYxFjTqQbOai5YDm6RsOVUbH9+EMA8zKTxk6QDKrI4psvh9OT0 tdtFHR7UCohyPOfPRX+srh53WrkZpWZFdvOlvYzO0pjU5a0DR42aYRKl3AyoYIn6SeHe VrTg== 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=uTfG28cRodiq/+2LJPZqP5fNSiZIDmn4jveiK6bxlps=; b=WTqSIwKdWrXp/4ttou+XI4MmDEPFrtk3l8K2jwOOkJX8CqJE5Wkr2I6WWEiB3vrAYq vAI5nuze9tDfxHNbsRTpdy566WI90KGLR64DhBy69WnfWES6lqV3y1Bz8mXWIZJjUTTe DfiPEjM11BvaRbd4wCDCCgbKz4xkk2c/OfiAB/2Fvh3A4exkuDoZYb/VikmwAEOp+jN0 UVsQTjcTEEUrpzxhXN/uwKEo3o3rwIFRPvVohU9HOeyrukQ5KhwJurI/a7cYOQD5lmsc s9b3UOrML0f2dHalH76zs+2QLvV4Y1QXHChzkgj/P36eP/nWdxq6snPc6HMmECAioY8D LqEQ== X-Gm-Message-State: AOAM531cuHu8P8DeBqLTDbNxXRls8s8QjuamNn6sOPEqunkh0GBnT6yZ IDLqS2m/UwvvGoXKAgfA6DSx1wnf8alcNqKPlp1GyA== X-Received: by 2002:ac2:5f19:0:b0:44a:f3de:58bd with SMTP id 25-20020ac25f19000000b0044af3de58bdmr6480353lfq.645.1649258530121; Wed, 06 Apr 2022 08:22:10 -0700 (PDT) MIME-Version: 1.0 References: <1649239025-10010-1-git-send-email-zgpeng@tencent.com> In-Reply-To: <1649239025-10010-1-git-send-email-zgpeng@tencent.com> From: Vincent Guittot Date: Wed, 6 Apr 2022 17:21:58 +0200 Message-ID: Subject: Re: [PATCH] sched/fair: Move calculate of avg_load to a better location 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 11:57, zgpeng wrote: > > In calculate_imbalance function, when the value of local->avg_load is > greater than or equal to busiest->avg_load, the calculated sds->avg_load is > not used. So this calculation can be placed in a more appropriate position. > > Signed-off-by: zgpeng > Reviewed-by: Samuel Liao Reviewed-by: Vincent Guittot > --- > kernel/sched/fair.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c > index d4bd299..601f8bd 100644 > --- a/kernel/sched/fair.c > +++ b/kernel/sched/fair.c > @@ -9460,8 +9460,6 @@ static inline void calculate_imbalance(struct lb_env *env, struct sd_lb_stats *s > local->avg_load = (local->group_load * SCHED_CAPACITY_SCALE) / > local->group_capacity; > > - sds->avg_load = (sds->total_load * SCHED_CAPACITY_SCALE) / > - sds->total_capacity; > /* > * If the local group is more loaded than the selected > * busiest group don't try to pull any tasks. > @@ -9470,6 +9468,9 @@ static inline void calculate_imbalance(struct lb_env *env, struct sd_lb_stats *s > env->imbalance = 0; > return; > } > + > + sds->avg_load = (sds->total_load * SCHED_CAPACITY_SCALE) / > + sds->total_capacity; > } > > /* > -- > 2.9.5 >