Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp3630504rwb; Fri, 20 Jan 2023 20:26:00 -0800 (PST) X-Google-Smtp-Source: AMrXdXuFFzQRCHA3+n+K8XZuvtP8AHtil2AIWLjocnl40eR+5+45PYl+PnoHJ5X6bWG2TlTOA97V X-Received: by 2002:aa7:c917:0:b0:483:5e56:7bc5 with SMTP id b23-20020aa7c917000000b004835e567bc5mr16798664edt.40.1674275160016; Fri, 20 Jan 2023 20:26:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674275160; cv=none; d=google.com; s=arc-20160816; b=ae8COXM/w+NvYSf00oUJoj4thQpMlyBDLNVk00hEYaIMaf5ABrdvkgOUISV50j5EGm zO9tNz73JdV4kroMjkIlJD8CnOU5hO8q/1fXZI5/HAUxzXI35GeS4FxgUZAnyL6sQTr4 vh7SAOFUDPeiKbI9j9l0g6M2f42atpwTrGvzlFiHvHIuaNHERCPYv6D84/sCgSlvRZaF rqmbE4Z/ugCl5Ar4AEnpRUH57baY9Aa5WhokCcravUsIeFJKM/9v4GDwBdLFacrLFkDv bOl++r7AxKZcMamEC+Rc5SFWmxaFoXzMEOk/8r/I9V0Rg/5AG5PYA3N6Lfy/XwT4jQiq j46Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=91fcZuIyY4pZHLtPybZ4iBZso0SxeeXvMXKXY9svhwg=; b=zI7et3BCNzvwjwIxttrf3lhaeaJbdh7rsu3/ZgI0kn8eTam9MhJY4L4H8ivhvIZYww rBDFB1Iz0+X4u3Gzss6c/cDr82sTtStlmZuwr5nw5WawV27Q/DcVI2guw7nfOatqrr/3 9hnqSfAjWyqY5dPrYA0jVwirbtnKkILYrSrrJm+IzvEhuXeOEnhLsCFh/Ocf150/u2CI CgMKq/4FRjInGFoO4ZoNPD2lSC0a+ghneV3xkhGhgZDS5xqEGWWS8z8HWNvxExmT7Gbb rAx1ErfjDksktlgCIHtUQUOpTU19rP5bD8yDFwCnCQAFusWEzCnv8OoBgUFMIyo/y5qO KelA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=TYn7FhgO; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a5-20020aa7d905000000b0049e6a68b509si6590219edr.631.2023.01.20.20.25.26; Fri, 20 Jan 2023 20:25:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=TYn7FhgO; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229534AbjAUEYm (ORCPT + 99 others); Fri, 20 Jan 2023 23:24:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229484AbjAUEYl (ORCPT ); Fri, 20 Jan 2023 23:24:41 -0500 Received: from mail-qt1-x82c.google.com (mail-qt1-x82c.google.com [IPv6:2607:f8b0:4864:20::82c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BECE74FCF3; Fri, 20 Jan 2023 20:24:40 -0800 (PST) Received: by mail-qt1-x82c.google.com with SMTP id e8so5844985qts.1; Fri, 20 Jan 2023 20:24:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=91fcZuIyY4pZHLtPybZ4iBZso0SxeeXvMXKXY9svhwg=; b=TYn7FhgOP8D6RAWzli28TBrMktadRuInALWG/3EHlqI+hrhC9AqsCTaUMdDDfO/geM ugems9KHeLAfzCfaAED1KeA0/4EYtvW4nsvg/ISYjXJle/zX5Z8iPLBVtiE1eE5SuP7Q 1YfL4aQ2Rz3S0e8uQiN2mnY3bn9VlgQX7HzrRpsF2ddcr0HEwo9Fsn9bUSoQlwwtvC2A XJJhPEqHGjAZtNz4mWv50MpIf/l647nJ+5dsfVl9wkudBkF/+HwCJoOIMH7OPiQOxBwG ji+K56I9UNN7YAGFuSaRajutULSV4Nwn8RwxDkRJPbs+SgvF4eys7Qv5jY4qqJEcvAI6 UCxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=91fcZuIyY4pZHLtPybZ4iBZso0SxeeXvMXKXY9svhwg=; b=Lu2ng4NRtCVFvwY7gizsk4mhG2Jcf4Rza2OWAIFdtqMCEI0PgF2kUg09JoRLoudhLw 85Ox49UajhLjm4W8ar8ImZd4l1TBhDSw9DzRK2R9vXRSul58BNVSnFfhL8lqxT0qvG2L SG0+EMiCKxg78OnxxQu7Xii2XHRI/2Yfpahxl97I80uM1zmnJ7xZ686kgJjxTuhd74kz dS6z0JN1n3rbprXhHYhRWlAbpqjh0Qm+X7BCb7OcJwRVYrkj+29FbOJJBMmVG1YmuI9F 5HwQL/ldWF/kjkoqk+XXzVc0BiJ2ERZ6J+9H3JCkEaT5oKkAPyGbwcMwDViptYbDOa3W ACuQ== X-Gm-Message-State: AFqh2kollBtbtQCU1wuGZOsd4weK/kVGYIjCBZsNUjjHCc2puhivOLrq sXGuGGRDR3UrbY8DX0A8FMYJu4MpqQQ= X-Received: by 2002:ac8:44ac:0:b0:3ae:4e47:52d7 with SMTP id a12-20020ac844ac000000b003ae4e4752d7mr22718279qto.38.1674275079012; Fri, 20 Jan 2023 20:24:39 -0800 (PST) Received: from localhost (50-242-44-45-static.hfc.comcastbusiness.net. [50.242.44.45]) by smtp.gmail.com with ESMTPSA id v7-20020a05620a440700b006fb112f512csm27622452qkp.74.2023.01.20.20.24.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Jan 2023 20:24:38 -0800 (PST) From: Yury Norov To: linux-kernel@vger.kernel.org, "David S. Miller" , Andy Shevchenko , Barry Song , Ben Segall , Dietmar Eggemann , Gal Pressman , Greg Kroah-Hartman , Haniel Bristot de Oliveira , Heiko Carstens , Ingo Molnar , Jacob Keller , Jakub Kicinski , Jason Gunthorpe , Jesse Brandeburg , Jonathan Cameron , Juri Lelli , Leon Romanovsky , Linus Torvalds , Mel Gorman , Peter Lafreniere , Peter Zijlstra , Rasmus Villemoes , Saeed Mahameed , Steven Rostedt , Tariq Toukan , Tariq Toukan , Tony Luck , Valentin Schneider , Vincent Guittot Cc: Yury Norov , linux-crypto@vger.kernel.org, netdev@vger.kernel.org, linux-rdma@vger.kernel.org Subject: [PATCH RESEND 0/9] sched: cpumask: improve on cpumask_local_spread() locality Date: Fri, 20 Jan 2023 20:24:27 -0800 Message-Id: <20230121042436.2661843-1-yury.norov@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org cpumask_local_spread() currently checks local node for presence of i'th CPU, and then if it finds nothing makes a flat search among all non-local CPUs. We can do it better by checking CPUs per NUMA hops. This has significant performance implications on NUMA machines, for example when using NUMA-aware allocated memory together with NUMA-aware IRQ affinity hints. Performance tests from patch 8 of this series for mellanox network driver show: TCP multi-stream, using 16 iperf3 instances pinned to 16 cores (with aRFS on). Active cores: 64,65,72,73,80,81,88,89,96,97,104,105,112,113,120,121 +-------------------------+-----------+------------------+------------------+ | | BW (Gbps) | TX side CPU util | RX side CPU util | +-------------------------+-----------+------------------+------------------+ | Baseline | 52.3 | 6.4 % | 17.9 % | +-------------------------+-----------+------------------+------------------+ | Applied on TX side only | 52.6 | 5.2 % | 18.5 % | +-------------------------+-----------+------------------+------------------+ | Applied on RX side only | 94.9 | 11.9 % | 27.2 % | +-------------------------+-----------+------------------+------------------+ | Applied on both sides | 95.1 | 8.4 % | 27.3 % | +-------------------------+-----------+------------------+------------------+ Bottleneck in RX side is released, reached linerate (~1.8x speedup). ~30% less cpu util on TX. This series was supposed to be included in v6.2, but that didn't happen. It spent enough in -next without any issues, so I hope we'll finally see it in v6.3. I believe, the best way would be moving it with scheduler patches, but I'm OK to try again with bitmap branch as well. Tariq Toukan (1): net/mlx5e: Improve remote NUMA preferences used for the IRQ affinity hints Valentin Schneider (2): sched/topology: Introduce sched_numa_hop_mask() sched/topology: Introduce for_each_numa_hop_mask() Yury Norov (6): lib/find: introduce find_nth_and_andnot_bit cpumask: introduce cpumask_nth_and_andnot sched: add sched_numa_find_nth_cpu() cpumask: improve on cpumask_local_spread() locality lib/cpumask: reorganize cpumask_local_spread() logic lib/cpumask: update comment for cpumask_local_spread() drivers/net/ethernet/mellanox/mlx5/core/eq.c | 18 +++- include/linux/cpumask.h | 20 +++++ include/linux/find.h | 33 +++++++ include/linux/topology.h | 33 +++++++ kernel/sched/topology.c | 90 ++++++++++++++++++++ lib/cpumask.c | 52 ++++++----- lib/find_bit.c | 9 ++ 7 files changed, 230 insertions(+), 25 deletions(-) -- 2.34.1