Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp200290iob; Wed, 11 May 2022 12:26:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwxNRkUWDcLryri02F3/iTmuW6CPVdXAOfMzK02ZYWIiIOOo8P9wuid4TljtauyYHKrM4Z+ X-Received: by 2002:a63:5211:0:b0:3db:1c36:fc37 with SMTP id g17-20020a635211000000b003db1c36fc37mr4350760pgb.572.1652297206338; Wed, 11 May 2022 12:26:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652297206; cv=none; d=google.com; s=arc-20160816; b=oopQj5vMONcCBRUmnuH+QtFYUN19ZISYrF8MwlqWhAa+6JHs3yEbMG2Qtk69JVUU0u 0/9k55jFkA3wDNZwu0M7AW8ASf1xmHXYTs0cDcz7sv1z5ekn6wEZ9ov2eeovykLQBWEa tg84vdG0JIbOhi+UqSAFDzAoRb2WbSDP3wXbjxGBv7ARp73P3kNsFAgnzMonCn6R7ZFE cIl2O5Jm9QjCuTcoU9G7Dbx+skwAqC6A/N4VaahWJitPwNmnCcl2rBsaVPTGkNizNoWU 4J46Z3rwzMiJQUKRNqRAz2yuL6tvUG6ujn6wM89Hv6OPx+7usQfvqzh+gzKqYHNmIgt1 Tx3w== 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=OLDx50NfOv95rQkmGrocJEc/FTdBhJTy+64BudzMBuN15+28+6Pgc25lAm7EvRlKt7 YhqmPpeP34cCPPMEDA2RMJLsodKvB3rNL0sEUfiOuKh8TBNAF9c4ogtsH9fNHDmpd0nd ATI2BtVP0BSup5uS049nT0Khe5la4ix3x/zo0hsVurbPqZ4vSF12N6lKD634qS8EdshS Q3S8pReWM60RFcJjR3Suys2YERuy2YBI95NrQ9lCOrLUXdlG8OQIl69cD1nR2U1fpnmq eC5koAEa7W5aBqh60milBADophUils8ds8Gaymvohf3DyCmFX6KNkOXhYvrjFdw6rzgn CYxg== 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 d14-20020a056a00244e00b00510496c4bd3si3383751pfj.250.2022.05.11.12.26.31; Wed, 11 May 2022 12:26:46 -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 S244820AbiEKObf (ORCPT + 99 others); Wed, 11 May 2022 10:31:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244782AbiEKObP (ORCPT ); Wed, 11 May 2022 10:31:15 -0400 Received: from outbound-smtp60.blacknight.com (outbound-smtp60.blacknight.com [46.22.136.244]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 533F250E15 for ; Wed, 11 May 2022 07:31:12 -0700 (PDT) Received: from mail.blacknight.com (pemlinmail03.blacknight.ie [81.17.254.16]) by outbound-smtp60.blacknight.com (Postfix) with ESMTPS id 793EDFAC9E for ; Wed, 11 May 2022 15:31:11 +0100 (IST) Received: (qmail 7479 invoked from network); 11 May 2022 14:31:11 -0000 Received: from unknown (HELO morpheus.112glenside.lan) (mgorman@techsingularity.net@[84.203.198.246]) by 81.17.254.9 with ESMTPA; 11 May 2022 14:31:11 -0000 From: Mel Gorman To: Peter Zijlstra Cc: Ingo Molnar , Vincent Guittot , Valentin Schneider , Aubrey Li , LKML , Mel Gorman Subject: [PATCH 2/4] sched/numa: Do not swap tasks between nodes when spare capacity is available Date: Wed, 11 May 2022 15:30:36 +0100 Message-Id: <20220511143038.4620-3-mgorman@techsingularity.net> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220511143038.4620-1-mgorman@techsingularity.net> References: <20220511143038.4620-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