From patchwork Sat Aug 19 14:12:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 13358636 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2B2B2EE4993 for ; Sat, 19 Aug 2023 14:12:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2B483900016; Sat, 19 Aug 2023 10:12:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1C3B1900011; Sat, 19 Aug 2023 10:12:49 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E490F900016; Sat, 19 Aug 2023 10:12:49 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id C704B900007 for ; Sat, 19 Aug 2023 10:12:49 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id A687916092C for ; Sat, 19 Aug 2023 14:12:49 +0000 (UTC) X-FDA: 81141045258.20.B8BE4CC Received: from mail-qv1-f48.google.com (mail-qv1-f48.google.com [209.85.219.48]) by imf12.hostedemail.com (Postfix) with ESMTP id D706340003 for ; Sat, 19 Aug 2023 14:12:47 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=DG6joiC2; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf12.hostedemail.com: domain of yury.norov@gmail.com designates 209.85.219.48 as permitted sender) smtp.mailfrom=yury.norov@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1692454367; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=SmmjHmVn6ls0sfUQEL2MtTTuL3JIkk0EADWsp1ssJ1I=; b=L9k3CIBpc8PbewEekrpjM9wSpvaPyNct+frv8DUmeEbZxZYtD5y96m8wvRztlL06DlaSDU afZ8tMzUKKK/LKpdHkg6NvdSIpUhl91eDlpV6Y1AX+AcypZa1wZv0BoQ4pC7XuO5MeZc2U 1FvAz/un+NILAbkmyd6AsWcBEYvgd20= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=DG6joiC2; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf12.hostedemail.com: domain of yury.norov@gmail.com designates 209.85.219.48 as permitted sender) smtp.mailfrom=yury.norov@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1692454367; a=rsa-sha256; cv=none; b=ocs06AQMLDw+WBoMKSH7XqT4AoRan5bi8b1Jp5/sVtBjYUmXnlDZig1zo7SwIf/c+ZCVzO D1nAFoqFSzlmDu8yZ1LHWeCkvTxdNbEy3FiAkwlB83hbzd7xxvmfDyE3gPC4Yj75iU0/Q9 pV6ms4ft5U7vZEPCyW20o9HvBqanWco= Received: by mail-qv1-f48.google.com with SMTP id 6a1803df08f44-64f383be0d4so146586d6.3 for ; Sat, 19 Aug 2023 07:12:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1692454367; x=1693059167; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=SmmjHmVn6ls0sfUQEL2MtTTuL3JIkk0EADWsp1ssJ1I=; b=DG6joiC2Lh32MiV3Hhqxx3JWfQDfDz/+8b0EdnMI1S+h3jh7LlNSk0ZQqNJgRg62Z7 3rlaxuUKCDxday8et0CVelK2WFG3zjQNY2LFZOzuTLwxfBhJqvEfVigb/4QPBMbQcxjU qjqzPnj0LYYPPADAvFTkSkVDZfLtCn1hLjx1jfvoUGGiDN9oLQeTTHtTTmJTcCitifem CKA0GfI3ugT45tKAdlgqZEDA18Rftgam1AdPVf8K6HYQufQ6i7Il64g3uPRSBc+0rc0k wfwnK3RBh06a2KwGVvE7GvgcZQYFOyPzUvnjFYV6Kv+K90LdXhq+3wO3Px4qqG69USp8 cr3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692454367; x=1693059167; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SmmjHmVn6ls0sfUQEL2MtTTuL3JIkk0EADWsp1ssJ1I=; b=jJPncZP9twfm3Vu9ADbH9DutggrjzeYOxYyrrlNrGBuSNY+xIbr0HttuAmElCDAbUp dUSaiaVMLAbOfsY7Yj96zH3z7HnlqQomPulvNSomEOnJLiifE5+8FazwNo5iavvTF9IH QIfZuLPsjWmnlqmgBTbl1HpFIg9/bERlSZ6qtjyUMkrMz87XY4kmV13lyCDp1ex99BQj dlPYDVlt0ASJK4UpREnp4ux46ZnDxbgf4bfVYm4i2qUhjppainnRVDDxddRh4dK3f764 6J2Tap2THEjxmLBl7uOPXs7+j0/jy+TXPfvN+b5ZM0r+IXLo/RC8xTMLz41WL7ZrshxO xezg== X-Gm-Message-State: AOJu0YyIDKZ9+M79XX3L970gnMvnfy09bvhFRFmN/gtm51xVdYl6Mpk9 DRwYROegrnN84LxwbwS9QHM= X-Google-Smtp-Source: AGHT+IEfRsyy5LserSpARnbs4AMrhHIcl356NFzEZZyieATaLVkGrmSM4un/e4KNH9OAVV4li0xoAg== X-Received: by 2002:a0c:e413:0:b0:64b:997f:5a7e with SMTP id o19-20020a0ce413000000b0064b997f5a7emr2602799qvl.8.1692454366974; Sat, 19 Aug 2023 07:12:46 -0700 (PDT) Received: from localhost ([32.218.242.113]) by smtp.gmail.com with ESMTPSA id g22-20020a0caad6000000b006262de12a8csm1464891qvb.65.2023.08.19.07.12.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Aug 2023 07:12:46 -0700 (PDT) From: Yury Norov To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: Yury Norov , Ingo Molnar , Peter Zijlstra , Andrew Morton , Ben Segall , Daniel Bristot de Oliveira , Dietmar Eggemann , Jacob Keller , Jakub Kicinski , Juri Lelli , Mel Gorman , Steven Rostedt , Tariq Toukan , Valentin Schneider , Vincent Guittot , shiju.jose@huawei.com, jonathan.cameron@huawei.com, prime.zeng@huawei.com, linuxarm@huawei.com, yangyicong@hisilicon.com, Andy Shevchenko , Rasmus Villemoes Subject: [PATCH v2 4/6] sched: fix sched_numa_find_nth_cpu() in non-NUMA case Date: Sat, 19 Aug 2023 07:12:36 -0700 Message-Id: <20230819141239.287290-5-yury.norov@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230819141239.287290-1-yury.norov@gmail.com> References: <20230819141239.287290-1-yury.norov@gmail.com> MIME-Version: 1.0 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: D706340003 X-Stat-Signature: hrifbaret7yhqoboo5od39fj7fqq1xja X-Rspam-User: X-HE-Tag: 1692454367-419844 X-HE-Meta: U2FsdGVkX1+RtCfsQ9NbjTtPWnnX6SyLPBygKSz8o4lmG5ERiGTqeFwcREBPeNZuwaYwfA3c3V48RxhkKdsTa3exkoS4IU8gXhHfIIDz5VHURkJ5tfEZ98f0ZUyfiVvyBjuy5jC4BAAmzLzgLRPDiOV3uaN13HE8BqP19UYaba7p8qAuaOLsyypfP31Z6ogdlGdlImeho3SkHt1foi1cd6NelNHUNzWE6MBywOxWHyrntrqSDaBerru+teVVPUk2yYrvkhzCJm7x2kVTqj35RF8fDOQRyXyGU1voY67f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ocjCxa3iePlByxFQzRH8CkCzr4PZTJe3deuLKF0ndrPTJiG/BpElJGYH/1szGdb5lnHslXSpx9UnTczXOel6SgfU5p7JqAaW/2XCVAxWMAQLnnAWDDbMSSAJ2Gh/HbvYVqiEMOQ2lHeL9Z6UmlKqMSFnOmg1pTS7zDjWmuWIcVKAxbyWCNezMfVv4UzKnyc/1gHM2wET3GJxu1xNisE/8FFjESw== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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 --- 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 fea32377f7c7..52f5850730b3 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 *