Message ID | 20230819141239.287290-6-yury.norov@gmail.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> 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 A0DF0EE4993 for <linux-mm@archiver.kernel.org>; Sat, 19 Aug 2023 14:12:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 128D2900018; Sat, 19 Aug 2023 10:12:51 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0B2C2900011; Sat, 19 Aug 2023 10:12:51 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E6D6F900018; Sat, 19 Aug 2023 10:12:50 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id C7D7B900011 for <linux-mm@kvack.org>; Sat, 19 Aug 2023 10:12:50 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 984A5A09A4 for <linux-mm@kvack.org>; Sat, 19 Aug 2023 14:12:50 +0000 (UTC) X-FDA: 81141045300.10.998606F Received: from mail-qk1-f169.google.com (mail-qk1-f169.google.com [209.85.222.169]) by imf27.hostedemail.com (Postfix) with ESMTP id CF67740013 for <linux-mm@kvack.org>; Sat, 19 Aug 2023 14:12:48 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=U7AgRT8E; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf27.hostedemail.com: domain of yury.norov@gmail.com designates 209.85.222.169 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=1692454368; 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=Crn5/+8WdRhCgV6i5ssfAVZRKeJzdqL7IL6ctYKnl6U=; b=ArhrtYFhJqOVSutgvvAFAp+8CNKf7tpBncUfSe+QuHVSPq05e1PDFEHRlmZtIRfYZ3Q/Qa 3BbnrRg3xebTwTDQSCye5+k7uNqFgo7eHjg9Bw17d6EiidlQ7Igpy9p++bft6RURcKe1ep DVyYAxeANSwN3wA7DEYavb4HvinBfyI= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=U7AgRT8E; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf27.hostedemail.com: domain of yury.norov@gmail.com designates 209.85.222.169 as permitted sender) smtp.mailfrom=yury.norov@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1692454368; a=rsa-sha256; cv=none; b=aqt7vbYUx/+p83q34231pBbRnxdjmfCGuTHe6zDVagcbvi0JmO4ipUmzVcC0YQ9K1Mo8AA D+ROxvHzda/l7Qx8kPojtUD5I7W7K2XNuHFR1tAXWR8T8ciMpdJs86Tq8dCpAHfg5P/35V G/fzdhroFrYaiFBTbWQWHcx+7IU3/KQ= Received: by mail-qk1-f169.google.com with SMTP id af79cd13be357-76d9a79e2fdso39459185a.1 for <linux-mm@kvack.org>; Sat, 19 Aug 2023 07:12:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1692454368; x=1693059168; 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=Crn5/+8WdRhCgV6i5ssfAVZRKeJzdqL7IL6ctYKnl6U=; b=U7AgRT8Ejxxl/VEdRwqDG1ENqN4QGxU6q+qxz0PKZpU9PSYvv4hGm/LQQLGxOrW1gJ CWLHmh7bBtOZQEIirnGLdBTRwYf5ThOF0JN0i91aMcJOkDKLZxhdvJ3WZr20h2BmTR/b icRcsHm5yrdnjCN64NRgjkhAgWD8MzAJiawtCyEU8rZpGuPTFn7dVM43FYHmSDsEpWgH WeYgmoVQ6tUx1hhTGyjdZmYTtK6mjtcolc7TSb9NigZLMaPqqeQrDZdjkyl/ECDxq5VC CZEAbglb9Y0vPOZDMQZOKdkUtKdyAS3YZNc/qBVNVgenMfI4FRZzgHQ1iiynIlneqMrG HyuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692454368; x=1693059168; 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=Crn5/+8WdRhCgV6i5ssfAVZRKeJzdqL7IL6ctYKnl6U=; b=RNWb4+sF0oUcdYXGsau7IeBCs4w+2v70QAlz4pp9GJzBST+M1DkpflH9EigIo5hHTr Ruwnt5bmj8LNqYKk96+Y8qRVTqg+DfxjzTgJc7zugLxmZ6WAyvib13IVG7O8FC7hDCwr 7W/tNJY9zPfYqP/OdNxukr697rySxuCl4mWt1ayS4CnQnapQ1Ddub7NXf1PxB7pBxg9k iYtyB1QxUbYBmnAmsNzcndbM/2qO+RX8+Ss8NHad5482u0t134t51o63KAdN2o/SqTgS EmAG6yHUKHpXZGRybvFsdmb60SQSrpWzh4WMavqoixb4sc8IRuDpRqLlb9s62QTVii+t Lsfw== X-Gm-Message-State: AOJu0YyAy9EfM63njfE/LPlvuGYALQhQ8qG/TrluyXiFWXQTR9heFIXG AeGiHZgmixw8jQcQFXdFCF4= X-Google-Smtp-Source: AGHT+IETTvZTEFyiJf8ZsCBw1Z942T/yFUfrCc+lCrhAif1gu2FCfd/M7wsnPaQD+/POCrDPVTsgpw== X-Received: by 2002:a05:620a:2987:b0:76c:e764:5081 with SMTP id r7-20020a05620a298700b0076ce7645081mr2825410qkp.37.1692454367995; Sat, 19 Aug 2023 07:12:47 -0700 (PDT) Received: from localhost ([32.218.242.113]) by smtp.gmail.com with ESMTPSA id 22-20020a05620a079600b0076ce061f44dsm1204827qka.25.2023.08.19.07.12.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Aug 2023 07:12:47 -0700 (PDT) From: Yury Norov <yury.norov@gmail.com> To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: Yury Norov <yury.norov@gmail.com>, Ingo Molnar <mingo@redhat.com>, Peter Zijlstra <peterz@infradead.org>, Andrew Morton <akpm@linux-foundation.org>, Ben Segall <bsegall@google.com>, Daniel Bristot de Oliveira <bristot@redhat.com>, Dietmar Eggemann <dietmar.eggemann@arm.com>, Jacob Keller <jacob.e.keller@intel.com>, Jakub Kicinski <kuba@kernel.org>, Juri Lelli <juri.lelli@redhat.com>, Mel Gorman <mgorman@suse.de>, Steven Rostedt <rostedt@goodmis.org>, Tariq Toukan <tariqt@nvidia.com>, Valentin Schneider <vschneid@redhat.com>, Vincent Guittot <vincent.guittot@linaro.org>, shiju.jose@huawei.com, jonathan.cameron@huawei.com, prime.zeng@huawei.com, linuxarm@huawei.com, yangyicong@hisilicon.com, Andy Shevchenko <andriy.shevchenko@linux.intel.com>, Rasmus Villemoes <linux@rasmusvillemoes.dk> Subject: [PATCH v2 5/6] sched: handle NUMA_NO_NODE in sched_numa_find_nth_cpu() Date: Sat, 19 Aug 2023 07:12:37 -0700 Message-Id: <20230819141239.287290-6-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 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: CF67740013 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: uhcq1p5z7grk6d5zyngsqq9zidgn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AaoKX8PC0EB4DziyVnNInwpOhZsBDSdvwsNuzVog20pd2uBp2a6vhM3psDc/ES5HyUDEityBMDD/zg9VJB7M+VgazFVE1q+4diBljb4LLWyYisNH45Jpw8nLlbDHeGBbg0tkC8RGBDkyisRznTzSm4NzcPwp95PiBRPHvmXDDPDvj/VEq/qXMlxsNAa4oUX/fkP8KGCzmoNf7Z0HGjIUM3fH3nEUSQGdqLRxxB5pcZaWQHC1xgw0mIB5/vVPiyAQ53w152+qG8o890VO8KZXk55RSC+wgsWksDO7KVs8jndIY0TjsM/xrQjjqN1xr9Ew6rSoyvmT2zZfgW8cAc44FswzU/8A8roubbsKJq1Kr7JpBrYjl0Sp6qO0Qczo2g+tTf7qmcK8wUfBA4SD8Cv7ua69Ikzr5zXC0VFASmMbYvkuK1Tdo3lG7gs9BpBYsqv3CVqe1vyY2y4pfDqQn6iRPfe4wbMP7vNjSPvvyLwj8cOwi37e+zxOZS4X4xTRolIzA== 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: <linux-mm.kvack.org> |
Series |
sched fixes
|
expand
|
diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c index c6e89afa0d65..bc6802700103 100644 --- a/kernel/sched/topology.c +++ b/kernel/sched/topology.c @@ -2117,6 +2117,9 @@ int sched_numa_find_nth_cpu(const struct cpumask *cpus, int cpu, int node) struct cpumask ***hop_masks; int hop, ret = nr_cpu_ids; + if (node == NUMA_NO_NODE) + return cpumask_nth_and(cpu, cpus, cpu_online_mask); + rcu_read_lock(); /* CPU-less node entries are uninitialized in sched_domains_numa_masks */ diff --git a/lib/cpumask.c b/lib/cpumask.c index 19277c6d551f..e77ee9d46f71 100644 --- a/lib/cpumask.c +++ b/lib/cpumask.c @@ -147,9 +147,7 @@ unsigned int cpumask_local_spread(unsigned int i, int node) /* Wrap: we always want a cpu. */ i %= num_online_cpus(); - cpu = (node == NUMA_NO_NODE) ? - cpumask_nth(i, cpu_online_mask) : - sched_numa_find_nth_cpu(cpu_online_mask, i, node); + cpu = sched_numa_find_nth_cpu(cpu_online_mask, i, node); WARN_ON(cpu >= nr_cpu_ids); return cpu;
sched_numa_find_nth_cpu() doesn't handle NUMA_NO_NODE properly, and may crash kernel if passed with it. On the other hand, the only user of sched_numa_find_nth_cpu() has to check NUMA_NO_NODE case explicitly. It would be easier for users if this logic will get moved into sched_numa_find_nth_cpu(). Signed-off-by: Yury Norov <yury.norov@gmail.com> --- kernel/sched/topology.c | 3 +++ lib/cpumask.c | 4 +--- 2 files changed, 4 insertions(+), 3 deletions(-)