From patchwork Thu Aug 10 16:24:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 13349710 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 EF326C001B0 for ; Thu, 10 Aug 2023 16:25:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8E3416B007E; Thu, 10 Aug 2023 12:25:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 893A96B0080; Thu, 10 Aug 2023 12:25:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7348A6B0081; Thu, 10 Aug 2023 12:25:03 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 649416B007E for ; Thu, 10 Aug 2023 12:25:03 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 3DA31C02C3 for ; Thu, 10 Aug 2023 16:25:03 +0000 (UTC) X-FDA: 81108719286.03.78C630F Received: from mail-pg1-f176.google.com (mail-pg1-f176.google.com [209.85.215.176]) by imf17.hostedemail.com (Postfix) with ESMTP id 6DAB440013 for ; Thu, 10 Aug 2023 16:25:01 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=Bfx08UPq; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf17.hostedemail.com: domain of yury.norov@gmail.com designates 209.85.215.176 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=1691684701; 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=F+0bGYwwZGmf0YA/0L0U+wptrqXuE/+ly84DG9C57lScIma1hjCe4W0rX3gIQWXivuwIkk /DnC02bvVxKVtwPIwZC3uvVvNVbhsefiE3VWg63vnYNXlKcBFqtX/IIhKiPNSHz2uusjtC +bhgKqY5NlcaWZwotTejJzDa9E+YCj0= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=Bfx08UPq; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf17.hostedemail.com: domain of yury.norov@gmail.com designates 209.85.215.176 as permitted sender) smtp.mailfrom=yury.norov@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1691684701; a=rsa-sha256; cv=none; b=nbfFanyvso/H8BOGPULtClp5Hsg4BYp8PVqVucXOmLTE+qTJDGLLLY/8XcUDHUfD/aw22H XGH+8wM5LmLhaHI2T10k8NTaXJjp+mCkiT2ebTW7XZ+OwboaTVyrDpl1zdhCFXIzHZPrcy sBjsfvSecS1+fc4+jquGbBAxT6MLy+U= Received: by mail-pg1-f176.google.com with SMTP id 41be03b00d2f7-55b0e7efb1cso748392a12.1 for ; Thu, 10 Aug 2023 09:25:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691684700; x=1692289500; 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=Bfx08UPqSGUA5kMzlG6c1gKFPujJymFxHHEcbncpgTNXWfilym9jS0kJbo5BDAWSAt D9mUQJQct3QouTQHkHkPrBDMCKnWAqpbreP6nPj61t/mOCWJMUiU9SBgEkrua+TY2WvN RQ5wEy+PuxBPt8ZoFj5D2HGw+0EHyLI1z4DoNLoS5QRQ61C+28JBYhQSRil/n4cmq226 +7wHPiq3FSMBXOYZHozHHb530CuwJI/i1j1XgNJxE8OzuAkHE9j+84kXPMYw7IqXs9K/ EXbvqacZmwYzBoSTAuKgMu8XWHjH7xGtl86RqyboalPaLOIF5AyV51Wm78Vn2A7DNWzT lIsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691684700; x=1692289500; 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=UEIX0gRFkc8LaqRkqiaIssMByDs0h3CtTaMNJ/NfKY3DkGztE0JPKw3to5yT8cndiw TMYLfhGcV9LZZOfP5xeo22B/Sspo0VvAHhXSlWoE3n23J756NDJyGIkyARitVtd4vhB0 eOROnEQVeDHfVTwCetl7nn+FmsX/9BMKRgEyh/CYmRmr8qmAQsA0xVO12nb2myguK2qD VLbmZSidF5YRK0EDfJNkbohNZnsg9VOx/vJPkM7bzWjegqcpp5Mfgo3TfFe6bnL7lj5i PziYSVYjdr4+kayQ9TOBtm7O9/oBixid/eZt8jg0aO9bEyOc2mFSF37LAMlOOmLGUDQD rlWg== X-Gm-Message-State: AOJu0YwE8enTeH0kKed7V4WKSwN7pStHQgfBO3ZKe73LY5ONxDRDG8GJ sSijxZfUnzjDRPcEPCehw3c= X-Google-Smtp-Source: AGHT+IH4taXK3kC2OJr25PCWrlpW+eWTUdvnoQR0cwNL04PBbBOADtjdA//KwLTk44jREORqIyxPQQ== X-Received: by 2002:a17:90b:4f8a:b0:267:f8a2:300a with SMTP id qe10-20020a17090b4f8a00b00267f8a2300amr2362896pjb.7.1691684700106; Thu, 10 Aug 2023 09:25:00 -0700 (PDT) Received: from localhost ([216.228.127.129]) by smtp.gmail.com with ESMTPSA id l9-20020a17090a070900b00267b38f5e13sm1811075pjl.2.2023.08.10.09.24.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Aug 2023 09:24:59 -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 , Peter Lafreniere , 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 4/4] sched: fix sched_numa_find_nth_cpu() in non-NUMA case Date: Thu, 10 Aug 2023 09:24:42 -0700 Message-Id: <20230810162442.9863-5-yury.norov@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230810162442.9863-1-yury.norov@gmail.com> References: <20230810162442.9863-1-yury.norov@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 6DAB440013 X-Stat-Signature: 3nneuxbqzib5etyo8j7yso6e7an7qsnf X-HE-Tag: 1691684701-322501 X-HE-Meta: U2FsdGVkX181ROMgtwKv4wbUDAfmJ8/SPm3lTNbdM39lcgjIz6Q/qxfCKbHo8VQSEuV6C+y49Mx9wbebp6dj5MiMwNH0C6x4+nWHnEW8J1W3ojSSw/cKeQipFQ++e4jHyZBscVCSuRysCICZpFw7TzsQf0SiuyrQjcaOfcA3AgDNcg/vjaBRpEa/oeWpNQunYpPkHgNF3l/pQXwf4hpZLF392RYt9bBQPo5uZhqMuzq6CmF5/BRNxrxQApy/sEGGFaV53ji58iaRAD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JPeuqTniji8HHLmM3uQbfBqPISizD7qUSvgAvwrCdzUDQZ10CK8QGU/qclW1w55miq63BpmxuD2h01s1aH0p0PsLBNgK6SchAnHmSeoA3Rd8asHZ84r5NvSNVwWKMFLr02jf0i27yt9GuQGa/9O0ineBzymIN6F3OryHLhgB6Kghcu5SHSDw7LbFu+sBDWqjdBVuOBA3c645vpmENXpmsMBrQGbGrUab0bQUmHFe/KIEtSY2CNFRhO0+lJBs+6FTV50OMA== 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 *