Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp1536537ioo; Sun, 22 May 2022 18:12:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyHU8brh00PdaLqAVfpV1ISBgZWAM3qwMK6obCz3Mxd+yS34ccpkTDbvsTJwHkyc04+pRGG X-Received: by 2002:a17:90b:4c88:b0:1df:c5e1:986e with SMTP id my8-20020a17090b4c8800b001dfc5e1986emr24043420pjb.8.1653268375874; Sun, 22 May 2022 18:12:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653268375; cv=none; d=google.com; s=arc-20160816; b=CMGEfrnrupCUcNzHrr5WF0/njlUkYh7MaSLsTQQ7d4a0WSXxIfDdzYA2xONarYPFlI fV5Uddzch2GLTp2Yu8XCc/zQ70nR2DvE+Ql31tExJI4KNqoV7ns0G4URHIkz+l9S3f81 I8PZ6EhYM9UJPCXQrMPV7LkBlT5Lw5Ys1UFZ9BfsMtciqdxavlHEGIrkNxD7zLxk9dly TUGmWWFlZFzBhAVRe67I0y1dR46x+FVkYIW3XAVGnqcEXw54QOJjirlvtcBYKDmw+ILc RETYVksXUJ1KbJ3lql2h4Z/wx/OW/8+N9M9LD5cCJqa8AN6/CO83s4DUQhN+LGoAYxLD UWgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=FalMQ6d3uZ0ZudRJrHZu4zxMeGeZdpM6PR4b/ytLfi0=; b=xWy6V2ShntKYe7CSpeeUYY8DsZtfuuXF6sj2z3XxJ1IQ+wgwAsqDOusE2YITTXjdHj y8XAv0vkCZTyTcB11QC0i/wQ5O/+okZ/X6p/7/4jeQwCVJNPJYRJ2zHrdDpk3FIX+03W kW6U3UBUpuq/MBoRh4gYDIARcWdweZdsjv8L1r+Qu4Uiq3WS/xas2+Qp8ntO87QAOrus Bb8GF7RN+o7PCLlQx2GyLH4//Kr1E5GKaJ9dAxbdtgL4MkszkhicfELKjCEFXvf3lnnw 0wsoamjoSVgm7uZKuuvykztsV+f4856d4ogQ8SNvbvskSe/T9AO8Aiyfr81fBuE/7Pcr iNVA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k1-20020a633d01000000b003fa2b3717c0si4185823pga.610.2022.05.22.18.12.44; Sun, 22 May 2022 18:12:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347431AbiETKgF (ORCPT + 99 others); Fri, 20 May 2022 06:36:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348202AbiETKf6 (ORCPT ); Fri, 20 May 2022 06:35:58 -0400 Received: from outbound-smtp63.blacknight.com (outbound-smtp63.blacknight.com [46.22.136.252]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0131C20F4B for ; Fri, 20 May 2022 03:35:51 -0700 (PDT) Received: from mail.blacknight.com (pemlinmail01.blacknight.ie [81.17.254.10]) by outbound-smtp63.blacknight.com (Postfix) with ESMTPS id 4B6ECFA96A for ; Fri, 20 May 2022 11:35:50 +0100 (IST) Received: (qmail 30665 invoked from network); 20 May 2022 10:35:50 -0000 Received: from unknown (HELO morpheus.112glenside.lan) (mgorman@techsingularity.net@[84.203.198.246]) by 81.17.254.9 with ESMTPA; 20 May 2022 10:35:50 -0000 From: Mel Gorman To: Peter Zijlstra Cc: Ingo Molnar , Vincent Guittot , Valentin Schneider , K Prateek Nayak , Aubrey Li , Ying Huang , LKML , Mel Gorman Subject: [PATCH 2/4] sched/numa: Do not swap tasks between nodes when spare capacity is available Date: Fri, 20 May 2022 11:35:17 +0100 Message-Id: <20220520103519.1863-3-mgorman@techsingularity.net> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220520103519.1863-1-mgorman@techsingularity.net> References: <20220520103519.1863-1-mgorman@techsingularity.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 If a destination node has spare capacity but there is an imbalance then two tasks are selected for swapping. If the tasks have no numa group or are within the same NUMA group, it's simply shuffling tasks around without having any impact on the compute imbalance. Instead, it's just punishing one task to help another. Signed-off-by: Mel Gorman --- kernel/sched/fair.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 867806a57119..03b1ad79d47d 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -1778,6 +1778,15 @@ static bool task_numa_compare(struct task_numa_env *env, */ cur_ng = rcu_dereference(cur->numa_group); if (cur_ng == p_ng) { + /* + * Do not swap within a group or between tasks that have + * no group if there is spare capacity. Swapping does + * not address the load imbalance and helps one task at + * the cost of punishing another. + */ + if (env->dst_stats.node_type == node_has_spare) + goto unlock; + imp = taskimp + task_weight(cur, env->src_nid, dist) - task_weight(cur, env->dst_nid, dist); /* -- 2.34.1