From patchwork Mon Sep 25 02:05:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 13397142 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 C41D7CE7A91 for ; Mon, 25 Sep 2023 02:05:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231631AbjIYCFn (ORCPT ); Sun, 24 Sep 2023 22:05:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35932 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229810AbjIYCFn (ORCPT ); Sun, 24 Sep 2023 22:05:43 -0400 Received: from mail-yw1-x1130.google.com (mail-yw1-x1130.google.com [IPv6:2607:f8b0:4864:20::1130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B1967BD; Sun, 24 Sep 2023 19:05:36 -0700 (PDT) Received: by mail-yw1-x1130.google.com with SMTP id 00721157ae682-59f7cc71e2eso10037637b3.0; Sun, 24 Sep 2023 19:05:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695607535; x=1696212335; darn=vger.kernel.org; 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=XPAXd9AbKmHdNRTfsq4M17cXn9dGkWOfPxW2lTik09I=; b=e1+qZ34p+Y1xPs7h14RDeJHKNxvyO8f2v9ikIxlr83HVPY2A6kLYhCxO2VmCG1WjWN JQiFuyqmVYQc0MTJwiFDKLehAIzYrZl+tgHIOBD4uQMhClPQwF/lePevDe+gMlxuZ+Nl mH4VAeg/LIkFMxexYSuNYh0oAjmhhhYxxY0iWFVgmY9JH4rUk1JOHCl/wVX2p/FccJxj kv1dqLayPse0P0iHJJj/MieBosfJsJIPLIv1V4atulaYXyr3k3sWMwZl+LvhoaGlmPAi KlkLd/OJPUah5wvirYfC+j72gBfRH+rpWU1vCSnspYgJhDleymFg3x+kJijV5Hyy0on2 s4uQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695607535; x=1696212335; 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=XPAXd9AbKmHdNRTfsq4M17cXn9dGkWOfPxW2lTik09I=; b=DMmMxyBu27TfhERpyCS2ReHAgh3W1yzbABBTK6lmUGO1cU/j7uNNdqkcUZrEbt6hkm YLH7l3POFZ/lWHVNiFSlqDmJBIHNoq7ByX8U3AJlGuErAKi2nbnubcU+uYZPlkzafEBH elqKrsXoPPZ7vPek8bPosAiWz3KINCRmX+xv2Pih1DdxpYPyGbs0Xx1rcDE7qC7Hqxu1 SHIRdLvs9EHWGYpf2JksG4E++38OVo8tT5ED9l9rRNgHlpLaKy67OUei4AxDvSeYD+v2 3ts+WwhNR3YOjeXb8iv5Rxuzdppzdi5Cgg5aM0lyrtJCs2E0zkouOsvux4B+Hyq7BoPZ Qhcg== X-Gm-Message-State: AOJu0Yy1VqS4Xdf5ca6ckGO4k5Pud9H8e0r610bZ6L9ImrtHeURf3EUo tGjGxwkeJ8dFcJfVvSU2ccYB0+mJo7s= X-Google-Smtp-Source: AGHT+IH8+eYi14F/2p5M0KFhVc6wMfpNm88zZOHympPW6B300GTbyalXgqm+PukIn00bNFRCPOBWxA== X-Received: by 2002:a81:4e42:0:b0:59b:14ca:4316 with SMTP id c63-20020a814e42000000b0059b14ca4316mr5342751ywb.43.1695607535532; Sun, 24 Sep 2023 19:05:35 -0700 (PDT) Received: from localhost ([2607:fb90:3eac:cd78:b6b5:ba0f:9e64:f2e1]) by smtp.gmail.com with ESMTPSA id gq10-20020a05690c444a00b0059f5828346csm957265ywb.3.2023.09.24.19.05.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Sep 2023 19:05:35 -0700 (PDT) From: Yury Norov To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-rdma@vger.kernel.org Cc: Yury Norov , Tariq Toukan , Valentin Schneider , Maher Sanalla , Ingo Molnar , Mel Gorman , Saeed Mahameed , Leon Romanovsky , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Daniel Bristot de Oliveira , Pawel Chmielewski , Jacob Keller , Yury Norov Subject: [PATCH 1/4] net: mellanox: drop mlx5_cpumask_default_spread() Date: Sun, 24 Sep 2023 19:05:25 -0700 Message-Id: <20230925020528.777578-2-yury.norov@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230925020528.777578-1-yury.norov@gmail.com> References: <20230925020528.777578-1-yury.norov@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org The function duplicates existing cpumask_local_spread(), and it's O(N), while cpumask_local_spread() implementation is based on bsearch, and thus is O(log n), so drop mlx5_cpumask_default_spread() and use generic cpumask_local_spread(). Signed-off-by: Yury Norov Signed-off-by: Yury Norov Reviewed-by: Jacob Keller --- drivers/net/ethernet/mellanox/mlx5/core/eq.c | 28 ++------------------ 1 file changed, 2 insertions(+), 26 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eq.c b/drivers/net/ethernet/mellanox/mlx5/core/eq.c index ea0405e0a43f..bd9f857cc52d 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eq.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eq.c @@ -828,30 +828,6 @@ static void comp_irq_release_pci(struct mlx5_core_dev *dev, u16 vecidx) mlx5_irq_release_vector(irq); } -static int mlx5_cpumask_default_spread(int numa_node, int index) -{ - const struct cpumask *prev = cpu_none_mask; - const struct cpumask *mask; - int found_cpu = 0; - int i = 0; - int cpu; - - rcu_read_lock(); - for_each_numa_hop_mask(mask, numa_node) { - for_each_cpu_andnot(cpu, mask, prev) { - if (i++ == index) { - found_cpu = cpu; - goto spread_done; - } - } - prev = mask; - } - -spread_done: - rcu_read_unlock(); - return found_cpu; -} - static struct cpu_rmap *mlx5_eq_table_get_pci_rmap(struct mlx5_core_dev *dev) { #ifdef CONFIG_RFS_ACCEL @@ -873,7 +849,7 @@ static int comp_irq_request_pci(struct mlx5_core_dev *dev, u16 vecidx) int cpu; rmap = mlx5_eq_table_get_pci_rmap(dev); - cpu = mlx5_cpumask_default_spread(dev->priv.numa_node, vecidx); + cpu = cpumask_local_spread(vecidx, dev->priv.numa_node); irq = mlx5_irq_request_vector(dev, cpu, vecidx, &rmap); if (IS_ERR(irq)) return PTR_ERR(irq); @@ -1125,7 +1101,7 @@ int mlx5_comp_vector_get_cpu(struct mlx5_core_dev *dev, int vector) if (mask) cpu = cpumask_first(mask); else - cpu = mlx5_cpumask_default_spread(dev->priv.numa_node, vector); + cpu = cpumask_local_spread(vector, dev->priv.numa_node); return cpu; } From patchwork Mon Sep 25 02:05:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 13397143 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 D7E64CE7A8B for ; Mon, 25 Sep 2023 02:05:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229810AbjIYCFq (ORCPT ); Sun, 24 Sep 2023 22:05:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231653AbjIYCFp (ORCPT ); Sun, 24 Sep 2023 22:05:45 -0400 Received: from mail-yw1-x1134.google.com (mail-yw1-x1134.google.com [IPv6:2607:f8b0:4864:20::1134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 69A87C6; Sun, 24 Sep 2023 19:05:38 -0700 (PDT) Received: by mail-yw1-x1134.google.com with SMTP id 00721157ae682-59e88a28b98so81466257b3.1; Sun, 24 Sep 2023 19:05:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695607537; x=1696212337; darn=vger.kernel.org; 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=Pl7WIkiSe4Zaq2jneMkE5sjlyOmEq/BXI+Yuo8w6qpI=; b=lRhDeWns/GH3kj1BIlPy/pkN28VoOLBbzXPEV/OR13sj5n7FUPF+XRcra+BtD7iQT3 WGxS9X4GVfqR5pcjR1UV+1WDviSzIPBC4+gw9ZvQRILUVd3VAPQlGjtOkJCyZHhbhW8H vLmke/6hkBRuIxyAd3aL+GcmsU3NR08+fTQ55tFOWXEMjtHJcn2fqk4mHNn2M2oS871l WoISSz88Gi+CZV3mnV32gXadNB7yCloDFP/V2wUGeQ/dBlLQs70HHxVjteQrr9Yem9Y7 LWl4ux4TEKFXKjueFUys5NuSZ3iuHkg8YFPp3Fgm+FN+1bt1nE9R+23Ap4o2idGsDHyu Ummw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695607537; x=1696212337; 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=Pl7WIkiSe4Zaq2jneMkE5sjlyOmEq/BXI+Yuo8w6qpI=; b=XL+fId42YNSDQBnQUBje0Jh0lCMlyeOn01ZjDKqNoFTlnrDfSGSLTcImxv4b7nV+ms Ik/NsrfV0fcdq/EWrmOSDAsQu+LA3qD/51nYit7FaDV6hhziflBAtbwqMG2487LLBImz alx0Fq6aQMPPZquFZBbv1/YjdcEOQrBQ05sivBQvKJxQpHitfcOm72gfVYZexnQEhX+B qo9sKf5xNxbPdA4SGctLlZeA0rltJW9JtGBISI1iO9aJeUPE9NxM8J9xOM9MERW1yLz5 AudvzZO46m5ttusnfsBHBjo23TEx5PBLv+r/tynWBA7U7pUm180+mb8qsI54Euqao7wG HtWQ== X-Gm-Message-State: AOJu0YzeDQKSfXg5DckaglxGpEC84LYtSex3AV9lDOLkUKdyt39RqcDs bt/0tILMnxIkMhkRR0PzwE9tizkriDM= X-Google-Smtp-Source: AGHT+IHZUE2RLaOIC8oHQElyrgZslaVjBNUUZZYSjLlbplvxcmxc9RmbkTE7mdselw6XFPW1qFeQqQ== X-Received: by 2002:a81:988b:0:b0:59f:6212:e174 with SMTP id p133-20020a81988b000000b0059f6212e174mr2053672ywg.12.1695607537192; Sun, 24 Sep 2023 19:05:37 -0700 (PDT) Received: from localhost ([2607:fb90:3eac:cd78:b6b5:ba0f:9e64:f2e1]) by smtp.gmail.com with ESMTPSA id n185-20020a8172c2000000b0059c01bcc363sm2179591ywc.49.2023.09.24.19.05.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Sep 2023 19:05:36 -0700 (PDT) From: Yury Norov To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-rdma@vger.kernel.org Cc: Yury Norov , Tariq Toukan , Valentin Schneider , Maher Sanalla , Ingo Molnar , Mel Gorman , Saeed Mahameed , Leon Romanovsky , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Daniel Bristot de Oliveira , Pawel Chmielewski , Jacob Keller , Yury Norov Subject: [PATCH 2/4] Revert "sched/topology: Introduce for_each_numa_hop_mask()" Date: Sun, 24 Sep 2023 19:05:26 -0700 Message-Id: <20230925020528.777578-3-yury.norov@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230925020528.777578-1-yury.norov@gmail.com> References: <20230925020528.777578-1-yury.norov@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org Now that the only user of for_each_numa_hop_mask() is switched to using cpumask_local_spread(), for_each_numa_hop_mask() is a dead code. Thus, revert commit 06ac01721f7d ("sched/topology: Introduce for_each_numa_hop_mask()"). Signed-off-by: Yury Norov Signed-off-by: Yury Norov Reviewed-by: Jacob Keller --- include/linux/topology.h | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/include/linux/topology.h b/include/linux/topology.h index fea32377f7c7..344c2362755a 100644 --- a/include/linux/topology.h +++ b/include/linux/topology.h @@ -261,22 +261,4 @@ sched_numa_hop_mask(unsigned int node, unsigned int hops) } #endif /* CONFIG_NUMA */ -/** - * for_each_numa_hop_mask - iterate over cpumasks of increasing NUMA distance - * from a given node. - * @mask: the iteration variable. - * @node: the NUMA node to start the search from. - * - * Requires rcu_lock to be held. - * - * Yields cpu_online_mask for @node == NUMA_NO_NODE. - */ -#define for_each_numa_hop_mask(mask, node) \ - for (unsigned int __hops = 0; \ - mask = (node != NUMA_NO_NODE || __hops) ? \ - sched_numa_hop_mask(node, __hops) : \ - cpu_online_mask, \ - !IS_ERR_OR_NULL(mask); \ - __hops++) - #endif /* _LINUX_TOPOLOGY_H */ From patchwork Mon Sep 25 02:05:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 13397144 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 A9C01CE7A91 for ; Mon, 25 Sep 2023 02:05:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231696AbjIYCFw (ORCPT ); Sun, 24 Sep 2023 22:05:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231648AbjIYCFq (ORCPT ); Sun, 24 Sep 2023 22:05:46 -0400 Received: from mail-yb1-xb2f.google.com (mail-yb1-xb2f.google.com [IPv6:2607:f8b0:4864:20::b2f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4BB13CA; Sun, 24 Sep 2023 19:05:40 -0700 (PDT) Received: by mail-yb1-xb2f.google.com with SMTP id 3f1490d57ef6-d86574d9bcaso3590768276.2; Sun, 24 Sep 2023 19:05:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695607539; x=1696212339; darn=vger.kernel.org; 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=tYYVzFPKU+1ehIbHqAxMjCLIu/yAEcO3F57HxWyY/K4=; b=TCjD8OX/kxMbatsUokTUPD2mhhjwj5XDqfj+oFCvVxaGkFk0aKz65mMmR65Zb6/IDr +c9cR6ZjXgmdIV736qXc5/FVLeTWbuqGwrqYWMB5RkurfxDuWwCjLxhkNpmSInVFJeTm hfZmPLYdYgfkquwZYFhH0xLNdqUMo2Xjieri6pp0cWbQ+AtbTj+QpkTlIL25RoM8xXnO dMY2QMcVdPI+9PixO/TdaWD6QJmfG2DoxJMsJ2DHs1zAMKFqKX1zLtGogUgQ5EcP0O0q 9tTSmmIaf0f0pwnNkYv2bhIhtn5AiU30e/W0+26YH7vGVjRf1V6Q/CVu4gvhA5eQvhmc nMlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695607539; x=1696212339; 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=tYYVzFPKU+1ehIbHqAxMjCLIu/yAEcO3F57HxWyY/K4=; b=NHaZUUs0JpO9zeNwvjmxEGKyolEk9lNCrUgytvBuMfgGuC9upp8VDRuC0F158jO2+s Xrzvsc66QV8yCW3PZjXOsQzYCsLGy0RQ1+b1OMcRXN6hiDcFq0Sx9Sfa0xjNoCv94zZR o9Scq/jw5hlMh6ehLy7ApbBmcUiWGy1Pe/k0OrojwZoI/uTURnBkrcJIHXr1BUIZhuuU fkLrbHPQTyp4zxla4bqct3Q8AAYX5Z+b5xS5Q6IgkT4+lJTqmx/s6xmwXqEmzqjeU6du g+TLJoCCV0Rakk8Vpr51lJpTkzGpeRA4Hip2MMhLW5mvlC89tSyERdv5l0DZFrEbVOUP 5fdg== X-Gm-Message-State: AOJu0Yx/CsYl2PGc9kMXzjx0kuMkh/E9H04defnzzor09ry0ft5aYdVK ukAPJo53N2U1bkCSC+PV6rGU1JLxP3k= X-Google-Smtp-Source: AGHT+IFL6pmeSmZk/RqQs4QZxi6TUUCsuCnak+Gj76eOWpXw9fX9S/Nueb/v5qEQnli1HkYHcIDCmg== X-Received: by 2002:a25:f05:0:b0:d81:582b:4652 with SMTP id 5-20020a250f05000000b00d81582b4652mr4410347ybp.21.1695607539032; Sun, 24 Sep 2023 19:05:39 -0700 (PDT) Received: from localhost ([2607:fb90:3eac:cd78:b6b5:ba0f:9e64:f2e1]) by smtp.gmail.com with ESMTPSA id o187-20020a25d7c4000000b00d7f06aa25c5sm2002474ybg.58.2023.09.24.19.05.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Sep 2023 19:05:38 -0700 (PDT) From: Yury Norov To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-rdma@vger.kernel.org Cc: Yury Norov , Tariq Toukan , Valentin Schneider , Maher Sanalla , Ingo Molnar , Mel Gorman , Saeed Mahameed , Leon Romanovsky , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Daniel Bristot de Oliveira , Pawel Chmielewski , Jacob Keller , Yury Norov Subject: [PATCH 3/4] Revert "sched/topology: Introduce sched_numa_hop_mask()" Date: Sun, 24 Sep 2023 19:05:27 -0700 Message-Id: <20230925020528.777578-4-yury.norov@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230925020528.777578-1-yury.norov@gmail.com> References: <20230925020528.777578-1-yury.norov@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org This reverts commit 9feae65845f7b16376716fe70b7d4b9bf8721848. Now that for_each_numa_hop_mask() is reverted, revert underlying machinery. Signed-off-by: Yury Norov Signed-off-by: Yury Norov Reviewed-by: Jacob Keller --- include/linux/topology.h | 7 ------- kernel/sched/topology.c | 33 --------------------------------- 2 files changed, 40 deletions(-) diff --git a/include/linux/topology.h b/include/linux/topology.h index 344c2362755a..72f264575698 100644 --- a/include/linux/topology.h +++ b/include/linux/topology.h @@ -247,18 +247,11 @@ static inline const struct cpumask *cpu_cpu_mask(int cpu) #ifdef CONFIG_NUMA int sched_numa_find_nth_cpu(const struct cpumask *cpus, int cpu, int node); -extern const struct cpumask *sched_numa_hop_mask(unsigned int node, unsigned int hops); #else static __always_inline int sched_numa_find_nth_cpu(const struct cpumask *cpus, int cpu, int node) { return cpumask_nth(cpu, cpus); } - -static inline const struct cpumask * -sched_numa_hop_mask(unsigned int node, unsigned int hops) -{ - return ERR_PTR(-EOPNOTSUPP); -} #endif /* CONFIG_NUMA */ #endif /* _LINUX_TOPOLOGY_H */ diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c index 05a5bc678c08..3f1c09a9ef6d 100644 --- a/kernel/sched/topology.c +++ b/kernel/sched/topology.c @@ -2143,39 +2143,6 @@ int sched_numa_find_nth_cpu(const struct cpumask *cpus, int cpu, int node) return ret; } EXPORT_SYMBOL_GPL(sched_numa_find_nth_cpu); - -/** - * sched_numa_hop_mask() - Get the cpumask of CPUs at most @hops hops away from - * @node - * @node: The node to count hops from. - * @hops: Include CPUs up to that many hops away. 0 means local node. - * - * Return: On success, a pointer to a cpumask of CPUs at most @hops away from - * @node, an error value otherwise. - * - * Requires rcu_lock to be held. Returned cpumask is only valid within that - * read-side section, copy it if required beyond that. - * - * Note that not all hops are equal in distance; see sched_init_numa() for how - * distances and masks are handled. - * Also note that this is a reflection of sched_domains_numa_masks, which may change - * during the lifetime of the system (offline nodes are taken out of the masks). - */ -const struct cpumask *sched_numa_hop_mask(unsigned int node, unsigned int hops) -{ - struct cpumask ***masks; - - if (node >= nr_node_ids || hops >= sched_domains_numa_levels) - return ERR_PTR(-EINVAL); - - masks = rcu_dereference(sched_domains_numa_masks); - if (!masks) - return ERR_PTR(-EBUSY); - - return masks[hops][node]; -} -EXPORT_SYMBOL_GPL(sched_numa_hop_mask); - #endif /* CONFIG_NUMA */ static int __sdt_alloc(const struct cpumask *cpu_map) From patchwork Mon Sep 25 02:05:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 13397145 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 42575CE7A95 for ; Mon, 25 Sep 2023 02:05:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231737AbjIYCFx (ORCPT ); Sun, 24 Sep 2023 22:05:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231678AbjIYCFv (ORCPT ); Sun, 24 Sep 2023 22:05:51 -0400 Received: from mail-yw1-x1136.google.com (mail-yw1-x1136.google.com [IPv6:2607:f8b0:4864:20::1136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8F88FE; Sun, 24 Sep 2023 19:05:42 -0700 (PDT) Received: by mail-yw1-x1136.google.com with SMTP id 00721157ae682-59eb8ec5e20so65009327b3.3; Sun, 24 Sep 2023 19:05:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695607542; x=1696212342; darn=vger.kernel.org; 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=v3Erv5jPUTJ6NOpgZnVC8ZDSsiaEDPSD4W7GSC7tyo4=; b=Bi1shG2CLDCY3BuMYL0NnCLxi+af/HNG0P6Q4Bj6OjpGwZTMboMw9EquA0oq+BN6WH 1JzASvtDdloPxJe3H4AzEANwtg0EW0M8maJzSfffgcOPQm7N+6jz0kfNQyfBxuRBHCH3 zGcJUsLM2a6vC1rYgaEAH1WoU8uSjrxSQYYuZmYJZUqaWuDAhuj9vJuXKXwcnj5IbU2/ iiWVqOzDu5Pnz0FEVAQPVoo89bbdmVL6a7qaeoiKAENXA+JhZEBuhqAc1yRxS4jFV14B DKifjOYLNuBKjzY9Z5stdXjlDeLxNBIjidn8pHICyeLpLft/jJDU/Icz3TRER+jcbuob HWJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695607542; x=1696212342; 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=v3Erv5jPUTJ6NOpgZnVC8ZDSsiaEDPSD4W7GSC7tyo4=; b=UkRFnz2iuB4Us0WVYOyZHxcfgbYLaa21QDCSjBJYNoeT47XAvsRHZkUQGI3RxOBS1v 22wAV5Zud78s9ebsvnLUEJ/S/B4PJw5xP+aBiDdlsAPANIxioGjdsMb294vTDYsiYY19 SkfKbjFVT0eTm1QaQGFbCysDIC816BGlDtCu0TJ8Et4putOMz+C4XHRIpXC7wd/toVSJ mulhF0OiMRRS2RMtW15YfAf1dewGbeXzO6FEfjEPQ/Fu64xuimXzwzojEC97gJIAosGJ 7VoE/mzBDxRGJYdrdzenWPtQKVnEIgpAgU+jQOvztbxTTO2NzXhiDULXHFOMP2C0Uj37 0lrw== X-Gm-Message-State: AOJu0Yyb5qp0+TINNdC0vOC4jOCxrQf47QuHpLubFB0dCNPB3kMCtZEe SyXfGpln2VsgaKt2n1l1V55dgNYmPL0= X-Google-Smtp-Source: AGHT+IG9HCuFwY+0LujiihwL4awznOH0oe6O5Sn3e5QdHFqMyDHQcOf0mONLO9JzR91UyWARlF+Sqg== X-Received: by 2002:a05:690c:c99:b0:59f:5da9:d53c with SMTP id cm25-20020a05690c0c9900b0059f5da9d53cmr4176407ywb.35.1695607541693; Sun, 24 Sep 2023 19:05:41 -0700 (PDT) Received: from localhost ([2607:fb90:3eac:cd78:b6b5:ba0f:9e64:f2e1]) by smtp.gmail.com with ESMTPSA id cn32-20020a05690c0d2000b005927a79333esm77968ywb.28.2023.09.24.19.05.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Sep 2023 19:05:41 -0700 (PDT) From: Yury Norov To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-rdma@vger.kernel.org Cc: Yury Norov , Tariq Toukan , Valentin Schneider , Maher Sanalla , Ingo Molnar , Mel Gorman , Saeed Mahameed , Leon Romanovsky , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Daniel Bristot de Oliveira , Pawel Chmielewski , Jacob Keller , Yury Norov Subject: [PATCH 4/4] lib/cpumask: don't mention for_each_numa_hop_mask in cpumask_local_spread()" Date: Sun, 24 Sep 2023 19:05:28 -0700 Message-Id: <20230925020528.777578-5-yury.norov@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230925020528.777578-1-yury.norov@gmail.com> References: <20230925020528.777578-1-yury.norov@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org Now that for_each_numa_hop_mask() is reverted, also revert reference to it in the comment to cpumask_local_spread(). This partially reverts commit 2ac4980c57f5 ("lib/cpumask: update comment for cpumask_local_spread()") Signed-off-by: Yury Norov Signed-off-by: Yury Norov Reviewed-by: Jacob Keller --- lib/cpumask.c | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/lib/cpumask.c b/lib/cpumask.c index a7fd02b5ae26..d341fb71a8a9 100644 --- a/lib/cpumask.c +++ b/lib/cpumask.c @@ -117,27 +117,6 @@ void __init free_bootmem_cpumask_var(cpumask_var_t mask) * * Returns online CPU according to a numa aware policy; local cpus are returned * first, followed by non-local ones, then it wraps around. - * - * For those who wants to enumerate all CPUs based on their NUMA distances, - * i.e. call this function in a loop, like: - * - * for (i = 0; i < num_online_cpus(); i++) { - * cpu = cpumask_local_spread(i, node); - * do_something(cpu); - * } - * - * There's a better alternative based on for_each()-like iterators: - * - * for_each_numa_hop_mask(mask, node) { - * for_each_cpu_andnot(cpu, mask, prev) - * do_something(cpu); - * prev = mask; - * } - * - * It's simpler and more verbose than above. Complexity of iterator-based - * enumeration is O(sched_domains_numa_levels * nr_cpu_ids), while - * cpumask_local_spread() when called for each cpu is - * O(sched_domains_numa_levels * nr_cpu_ids * log(nr_cpu_ids)). */ unsigned int cpumask_local_spread(unsigned int i, int node) {