From patchwork Fri Sep 15 12:03:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 140482 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6358:a55:b0:13f:353d:d1ed with SMTP id 21csp365697rwb; Fri, 15 Sep 2023 07:46:09 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEe4xpIicoLQ/Ur71VorqvagrytsInb/oY11jphUi0zx+9kjqcxFbgphxDXqWu4/exAMJcV X-Received: by 2002:a05:6358:5287:b0:139:d5d5:7a8f with SMTP id g7-20020a056358528700b00139d5d57a8fmr2368075rwa.30.1694789169439; Fri, 15 Sep 2023 07:46:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694789169; cv=none; d=google.com; s=arc-20160816; b=AT0uo/nmC+wbi2QOb9L4qxRw2X+Nz5RraTpJcErBsSMIZpezvQgk81s2RDaIzdiy8o kAbAMXlbCq+eCn9BPEWxXuPqbXx8Cb9dXiBl9Lvu3pu3Slk4Pdg/lzxyNfWwqy6swWHW 9PzxiXwjR8/nqXOXew+eBUgREypYXu1h3IYkJuveaLIiUSBtmMhFd+n/4bT3cvNkVCza W+lkpSNwUttdsKkzjEDHsJYwDRT6+eV+MqIIMsTwRljLIFljqtGXUYvsZ49qmGSzgsIN r4eFG8Pi1jreEWF6KDTk99u2+kHl+/LwBjo29zsEc4SUIkZE7cyxcowqJG4scXPwAkh2 9Wnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=tBk01TZqJa0xUvb64FfLoh9y4GLN054lkdXjN7A7La8=; fh=eKeIeQq6ZJEPpCVRKsN4VFa+FaRfE4kjc161Ip6RZyg=; b=SUZibtyNS8kA5umzfV/R6vJ08YbmTL+GZBtUJEtV0shsg/KQLUiewr0qZI7yNq0tWN hp7RJm0bKvmTpkc8abehh/KClhzN9533ne4qhS4qsHO10Gij+jgE148PY0aVo4t3uHj9 IPoOY+pVOMnrCkjmincaXATTdelaZ4yleAzf6CT6rWG48EyVFSY/TfCPPYz93LF2sMrM 60op6kdKUAZfzGtodZ2QHFSOhut/hB9Du589LuQVHgDZx+8ChUjJxbezDv1emnmm+r97 koWYTuVPagib8AnGoh20TCw9H6P1SwBTlifl9GEjWry8KQc1lTk6TAZ/gCCo7xpzCPAc th9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=EsaiYeOw; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id p2-20020a634202000000b00563f72935e3si3417796pga.608.2023.09.15.07.46.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 07:46:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=EsaiYeOw; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 8C1DC8220D5E; Fri, 15 Sep 2023 05:06:32 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234617AbjIOMGJ (ORCPT + 32 others); Fri, 15 Sep 2023 08:06:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234613AbjIOMGF (ORCPT ); Fri, 15 Sep 2023 08:06:05 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17F143584; Fri, 15 Sep 2023 05:03:30 -0700 (PDT) Date: Fri, 15 Sep 2023 12:03:29 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1694779409; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tBk01TZqJa0xUvb64FfLoh9y4GLN054lkdXjN7A7La8=; b=EsaiYeOw9T+ygEcGJlO8QQ8dsaBQfcqHNHFB3Cn+etpQ/UJ5l/e48LNvGwv+BQHC4F71SL iy7Yoo1PNrjEhYVjvERHW1/GHJIxwPntFtdHdPvZkKQrU7TQ+80w7POl+3DYg/jszoiLSc vEWVcnNKuj0s2bUWdc25YrcGKy6c2ORTiJ2bPbAAiYyby8w4i5noLrvvsmKHRpsgBy+foc WpOmoHFxsIVJ0n2baVyKvDozJIBaN5e1EqA49++wIxrFX0o+da2OVMgDvXE98G58p7l3nb qF3wSUjDtby0OlJsmgA6887byiKNnC1TafGXUvzCs0AsxB9Tr/frJ1woVK9f2A== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1694779409; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tBk01TZqJa0xUvb64FfLoh9y4GLN054lkdXjN7A7La8=; b=FmXegposMGlqeGZhwhfMgaDBYdRN9Mx1sWsk5hc86W+OZcE1q9kE0usBLy/FmOnGNK9ulz T7nJTK1oZkeUIzDA== From: "tip-bot2 for Yury Norov" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: sched/core] sched/fair: Fix open-coded numa_nearest_node() Cc: Yury Norov , Ingo Molnar , Mel Gorman , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20230819141239.287290-3-yury.norov@gmail.com> References: <20230819141239.287290-3-yury.norov@gmail.com> MIME-Version: 1.0 Message-ID: <169477940902.27769.3566376802843412168.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Fri, 15 Sep 2023 05:06:32 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777115248039482574 X-GMAIL-MSGID: 1777115248039482574 The following commit has been merged into the sched/core branch of tip: Commit-ID: d1db9fb432d50b0eecdfdd85d17cc15a59cc093b Gitweb: https://git.kernel.org/tip/d1db9fb432d50b0eecdfdd85d17cc15a59cc093b Author: Yury Norov AuthorDate: Sat, 19 Aug 2023 07:12:34 -07:00 Committer: Ingo Molnar CommitterDate: Fri, 15 Sep 2023 13:48:10 +02:00 sched/fair: Fix open-coded numa_nearest_node() task_numa_placement() searches for a nearest node to migrate by calling for_each_node_state(). Now that we have numa_nearest_node(), switch to using it. Signed-off-by: Yury Norov Signed-off-by: Ingo Molnar Cc: Mel Gorman Link: https://lore.kernel.org/r/20230819141239.287290-3-yury.norov@gmail.com --- kernel/sched/fair.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 8dbff6e..41cfd61 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -2847,19 +2847,7 @@ static void task_numa_placement(struct task_struct *p) } /* Cannot migrate task to CPU-less node */ - if (max_nid != NUMA_NO_NODE && !node_state(max_nid, N_CPU)) { - int near_nid = max_nid; - int distance, near_distance = INT_MAX; - - for_each_node_state(nid, N_CPU) { - distance = node_distance(max_nid, nid); - if (distance < near_distance) { - near_nid = nid; - near_distance = distance; - } - } - max_nid = near_nid; - } + max_nid = numa_nearest_node(max_nid, N_CPU); if (ng) { numa_group_count_active_nodes(ng);