From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7CA13C072A2 for ; Wed, 15 Nov 2023 19:20:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229529AbjKOTUa (ORCPT ); Wed, 15 Nov 2023 14:20:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229564AbjKOTU3 (ORCPT ); Wed, 15 Nov 2023 14:20:29 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D7E0912C for ; Wed, 15 Nov 2023 11:20:25 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 57653C433C8; Wed, 15 Nov 2023 19:20:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1700076025; bh=mByu1WIWOOxjIjB256VxniQkCiDXU/HE78ewecxc3EM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rFodUrYT1E3FKMxl+xxOgsKeyf2wcjD2b4pIL56D9COIB58tpQFXV2f0+nie+SekQ chfmlh4e8JtsFmIGMWgrjjVIceDMRRl56M7qVAAI6N6JNzgIjor+kCAdeeQSmtMw/A qVe160mtn5l7nQ4j45f1LYwqXyn+DMDWjdBfcZlE= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Yury Norov , Ingo Molnar , Mel Gorman , Sasha Levin Subject: [PATCH 6.5 004/550] sched/topology: Fix sched_numa_find_nth_cpu() in non-NUMA case Date: Wed, 15 Nov 2023 14:09:48 -0500 Message-ID: <20231115191601.020062279@linuxfoundation.org> X-Mailer: git-send-email 2.42.1 In-Reply-To: <20231115191600.708733204@linuxfoundation.org> References: <20231115191600.708733204@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org 6.5-stable review patch. If anyone has any objections, please let me know. ------------------ From: Yury Norov [ Upstream commit 8ab63d418d4339d996f80d02a00dbce0aa3ff972 ] When CONFIG_NUMA is enabled, sched_numa_find_nth_cpu() searches for a CPU in sched_domains_numa_masks. The masks includes only online CPUs, so effectively offline CPUs are skipped. When CONFIG_NUMA is disabled, the fallback function should be consistent. Fixes: cd7f55359c90 ("sched: add sched_numa_find_nth_cpu()") Signed-off-by: Yury Norov Signed-off-by: Ingo Molnar Cc: Mel Gorman Link: https://lore.kernel.org/r/20230819141239.287290-5-yury.norov@gmail.com Signed-off-by: Sasha Levin --- include/linux/topology.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/topology.h b/include/linux/topology.h index fea32377f7c77..52f5850730b3e 100644 --- a/include/linux/topology.h +++ b/include/linux/topology.h @@ -251,7 +251,7 @@ extern const struct cpumask *sched_numa_hop_mask(unsigned int node, unsigned int #else static __always_inline int sched_numa_find_nth_cpu(const struct cpumask *cpus, int cpu, int node) { - return cpumask_nth(cpu, cpus); + return cpumask_nth_and(cpu, cpus, cpu_online_mask); } static inline const struct cpumask * -- 2.42.0