Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp610003ybb; Wed, 8 Apr 2020 06:31:44 -0700 (PDT) X-Google-Smtp-Source: APiQypL69KiMM54VurqAR7WHlxH62XgPJXP2FrNPSJivY7IZ+4C242d2pH9f+AbGnMvsCDt7FmGB X-Received: by 2002:a9d:355:: with SMTP id 79mr5338858otv.174.1586352704641; Wed, 08 Apr 2020 06:31:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586352704; cv=none; d=google.com; s=arc-20160816; b=kr0wOu2hfDNsrMj4FBMSblV8zPjEDUKvhuBEgoAgDYF6Bdc89BzoU3S1URm3WHgpgd C6g/1yDZUZfpydpY5/cEcjrkacFOcGCXWlRXJtAjBALs9HQq11ZivJZJzJNTK1Jr2L5c 3py554uXOunP0Ebjxe7VI/EFbJajyfhwUMUOUHKXx2iBAxtpHADeAmNI6qtKz1trG66w 5HRXH+3C4A2GFCFh7rOmUwCTbahTz6RIfObIabgCsr7Nt+KErjC5amMS0z9P1gDMvjs8 8uNO64WIJpoqY/RB3BgoG63H91kC42DW+ULS2xQ9Qmq43cORn9ShXAy2kK78p6tIMDs8 qXrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :robot-unsubscribe:robot-id:message-id:mime-version:references :in-reply-to:cc:subject:to:reply-to:from:date; bh=9QMg0DaqdA4KmFxk/9N+nJ9pGuICq+DBhY7DKnoLBF0=; b=mk0kCNsVg06fWgsRiCGMEnArn51sDqCiBemqacx3gQ1tS2wATHH0pwpd2Gpax4xSGU JiK3+DJqd4+39xY/tZQeYkTx2Iyl6n813+L1d9m6OEM8nqo8IsbXQYQWqyFYWGg2JIC2 PAlOv8S/maXh0QbfoLtNqcE20Z0y/q8CSs5Vg0gkJyv1fP285o88kEllvOaij67pysA1 3IU0/+zb0pdbkSxmTYaWlCMR17+Z/N99gR2SAHaqTdXX2GLnN8++yCU7kVSFsibudhf6 uz3kNbBHVTCX57X6Eb5gC6r1B6r+rk/HRMTdqAt5xJQgopH2ho0jiyXVMqpGCJCg67mJ H9ng== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e23si2611994oth.117.2020.04.08.06.31.28; Wed, 08 Apr 2020 06:31:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728511AbgDHMUm (ORCPT + 99 others); Wed, 8 Apr 2020 08:20:42 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:49665 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728434AbgDHMUh (ORCPT ); Wed, 8 Apr 2020 08:20:37 -0400 Received: from [5.158.153.53] (helo=tip-bot2.lab.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1jM9gw-00065N-BO; Wed, 08 Apr 2020 14:20:26 +0200 Received: from [127.0.1.1] (localhost [IPv6:::1]) by tip-bot2.lab.linutronix.de (Postfix) with ESMTP id E2C931C0131; Wed, 8 Apr 2020 14:20:25 +0200 (CEST) Date: Wed, 08 Apr 2020 12:20:25 -0000 From: "tip-bot2 for Aubrey Li" Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: sched/urgent] sched/fair: Fix negative imbalance in imbalance calculation Cc: Vincent Guittot , Phil Auld , Mel Gorman , Aubrey Li , "Peter Zijlstra (Intel)" , Ingo Molnar , x86 , LKML In-Reply-To: <1585201349-70192-1-git-send-email-aubrey.li@intel.com> References: <1585201349-70192-1-git-send-email-aubrey.li@intel.com> MIME-Version: 1.0 Message-ID: <158634842556.28353.13089181370653976437.tip-bot2@tip-bot2> X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the sched/urgent branch of tip: Commit-ID: 111688ca1c4a43a7e482f5401f82c46326b8ed49 Gitweb: https://git.kernel.org/tip/111688ca1c4a43a7e482f5401f82c46326b8ed49 Author: Aubrey Li AuthorDate: Thu, 26 Mar 2020 13:42:29 +08:00 Committer: Ingo Molnar CommitterDate: Wed, 08 Apr 2020 11:35:20 +02:00 sched/fair: Fix negative imbalance in imbalance calculation A negative imbalance value was observed after imbalance calculation, this happens when the local sched group type is group_fully_busy, and the average load of local group is greater than the selected busiest group. Fix this problem by comparing the average load of the local and busiest group before imbalance calculation formula. Suggested-by: Vincent Guittot Reviewed-by: Phil Auld Reviewed-by: Vincent Guittot Acked-by: Mel Gorman Signed-off-by: Aubrey Li Signed-off-by: Peter Zijlstra (Intel) Signed-off-by: Ingo Molnar Link: https://lkml.kernel.org/r/1585201349-70192-1-git-send-email-aubrey.li@intel.com --- kernel/sched/fair.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 95cbd9e..02f323b 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -9036,6 +9036,14 @@ static inline void calculate_imbalance(struct lb_env *env, struct sd_lb_stats *s 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. + */ + if (local->avg_load >= busiest->avg_load) { + env->imbalance = 0; + return; + } } /*