From patchwork Tue Jul 19 16:23:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tariq Toukan X-Patchwork-Id: 12922728 X-Patchwork-Delegate: kuba@kernel.org 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 61FAAC43334 for ; Tue, 19 Jul 2022 16:24:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238478AbiGSQYB (ORCPT ); Tue, 19 Jul 2022 12:24:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238692AbiGSQX5 (ORCPT ); Tue, 19 Jul 2022 12:23:57 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2058.outbound.protection.outlook.com [40.107.223.58]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D740550C7; Tue, 19 Jul 2022 09:23:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SKejqM/u0A+bwAXCTqZ/k7/w3mxSHU0Jn/HbB+iswlCZJL6TE26qBUMxNOvpJEQOv6EyL2UJ0h6FZ6ocRxLtVaezg0xNKrSA0x/Nvf4k8uhvl8lAFbuGkIziNr4OmcDF+tXRGYvsVpAnuKNVM0l7Ql3kWh4NnA2hmgodB3X/APJKBn1W4J6I4D5bB3rCbbBcaLDYOuY6cRXwudxuikmWa5Si0dBHQPmTUnFrIrDqMaoU6OUcfSyBUcoAnuqSVXhqTJP8VCAaVm8w/zlopWwhpoIFb0kYRNwkCVY59zr3UQDEcmWAlJOoz1JuKh8jZNUkhGZtjursmcrWuyb8x6e5/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=896a1msK77/4vJIdyHpHWCnjcda8dseK05Hu8ZFf7+w=; b=WndM2qARq3UwcuIYWnrC5YxKXK9VmtVLhqXIz4DOSAozYpWfGdP8zlrqPKU/bW6bv41pjoMYgb3wXaxMkzGQU7hIoOrinlH1nEQqDyLMsLQZ+O7kpaKYr9R2+4P2hZVB9jgGmbAD29YjPa89XASeRACTPBepxYWxizWGrmaMpNDgViiyyzDTlhs0pAEUDr22MYWiTWLKBT8z1gBxzCNGZOxzF7G9z9g1Rqt4o+9e0z8bPBkOrwzq88e5NQ5ChkeADEnmvZvoxawa2/FF6tgm9mTsiDB/R0Vttt2dQer7oEAwHsZKO8hiC/SceZdQPibz5mzDEEOdtZkjqo5Puhg/Ng== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.238) smtp.rcpttodomain=redhat.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=896a1msK77/4vJIdyHpHWCnjcda8dseK05Hu8ZFf7+w=; b=Rc9sMiOmfvOa3RRF0EEcANTLvrAmfeYDYc2hXMb7QkhZNJH8I5cHKeE/ammRWCjAUVBKQLZDMEzmQTeRueGx52758VEJk2dYAQuJr9qXB2Tjlbpkjol1Z6EJlqnlqtX5w9nGpax82huHZDETyfySn3ehiJ+giatYKMhMAvPIWuGYSX8NDs4BWubwpt/PolHZNDq6XFFWcf8dP3qhTS1MyCNEtgw9cRZBOmXr0tUlof7u980GrxOEVsdPsVRRNsxQVL//R6wcU1Ep7g+FNguaKw6+momnwZ8oFG3vtb32WIDgEhZmqfiQSVvXndrADRZb98e7JRgZGNsTZ65nP1A8Lw== Received: from BN0PR04CA0116.namprd04.prod.outlook.com (2603:10b6:408:ec::31) by DM6PR12MB4204.namprd12.prod.outlook.com (2603:10b6:5:212::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.21; Tue, 19 Jul 2022 16:23:55 +0000 Received: from BN8NAM11FT005.eop-nam11.prod.protection.outlook.com (2603:10b6:408:ec:cafe::39) by BN0PR04CA0116.outlook.office365.com (2603:10b6:408:ec::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.22 via Frontend Transport; Tue, 19 Jul 2022 16:23:55 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.238) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 12.22.5.238 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.238; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (12.22.5.238) by BN8NAM11FT005.mail.protection.outlook.com (10.13.176.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5438.12 via Frontend Transport; Tue, 19 Jul 2022 16:23:54 +0000 Received: from drhqmail203.nvidia.com (10.126.190.182) by DRHQMAIL105.nvidia.com (10.27.9.14) with Microsoft SMTP Server (TLS) id 15.0.1497.32; Tue, 19 Jul 2022 16:23:54 +0000 Received: from drhqmail203.nvidia.com (10.126.190.182) by drhqmail203.nvidia.com (10.126.190.182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.26; Tue, 19 Jul 2022 09:23:53 -0700 Received: from vdi.nvidia.com (10.127.8.14) by mail.nvidia.com (10.126.190.182) with Microsoft SMTP Server id 15.2.986.26 via Frontend Transport; Tue, 19 Jul 2022 09:23:50 -0700 From: Tariq Toukan To: "David S. Miller" , Saeed Mahameed , Jakub Kicinski , Ingo Molnar , Peter Zijlstra , Juri Lelli CC: Eric Dumazet , Paolo Abeni , , Gal Pressman , Vincent Guittot , , Tariq Toukan Subject: [PATCH net-next V3 1/3] sched/topology: Add NUMA-based CPUs spread API Date: Tue, 19 Jul 2022 19:23:37 +0300 Message-ID: <20220719162339.23865-2-tariqt@nvidia.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20220719162339.23865-1-tariqt@nvidia.com> References: <20220719162339.23865-1-tariqt@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 26446a0b-e450-47f3-a964-08da69a31337 X-MS-TrafficTypeDiagnostic: DM6PR12MB4204:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zftFrKuLh5phMq/1A5vcNkFX9DnXTTvvmX2VPAPUo1M0fIxU/W1A3oAoUUDTHDNbkTPQDSuLj0kRCVfNex7GRgtDIUjXqLL4fUwQ8KvGHNxdH0wl6/9NmU53AZIM5Hgn1JpGWD9OnKfqqbCLwRRjkkGu+dXbdzYfNhQYyJzBJ3K2MYQBMzAqI+3aLhCB8QdmODrixUXhyERa5ve8dz7hn8ZEPpU5HSzkg3WvZXtKcQ9Z6sG9u1crb7+F3SGX3sKY+hbUWZlVdHJSiXbvWqiOYggfLp4Tdv4tOyBCi6ZY8JJ4WoQMFijHiBaFsHrJhjS1s8yjqjDxObJdD2FaaNjItkzVvJY+LUqlmOFyDpn60G7dv6c46o0mmrxNaxYdPodeBULRC+UEUqyJZs4P/LSDKPuKmTJ13ftnfFXyUNMO3jGMyGvv1hxCOKMuO3WA9UlLQCq7iqjR4RdPkfRrzpe/zVaqNnX2BrLNLhAqrESNwB+XH1dd9dT/9kOrXP+IIZJvsZ3s+A6A/PpmvTfx5kfBuIdqKojyUzWhZiL8NMjaqXItmiQdn7C3ZRuxx6Hq9rZvmrBbjwNxXFTZq6puC++CR1RWT567HtFMuDnl1o8xLGu849EYtQyYkQFKEvWrL+7CoOO7eW6noLKF6vQW6vvL5aYIPC1Q31KEVO1zBKtjWg15vw2kEuIpTugTrwIHsfrPOx6+mHRtB9SCYq0vXywi2a43wUCEszV1DGMCHnsk988CFrtxJzq/z/p9o5weoTdybRXX160HRCIim1uuNd9/BkhxbgDCU9sUuqYiS7M1c9pEO310cxvAvmaqu1QpHSJgh0xavySimfpU8kwxpqcvMw== X-Forefront-Antispam-Report: CIP:12.22.5.238;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:InfoNoRecords;CAT:NONE;SFS:(13230016)(4636009)(376002)(346002)(39860400002)(396003)(136003)(40470700004)(36840700001)(46966006)(8936002)(70206006)(8676002)(70586007)(4326008)(7696005)(81166007)(36756003)(110136005)(316002)(82740400003)(54906003)(40460700003)(356005)(83380400001)(2616005)(41300700001)(6666004)(86362001)(107886003)(1076003)(2906002)(186003)(40480700001)(478600001)(36860700001)(47076005)(426003)(336012)(5660300002)(7416002)(82310400005)(26005)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jul 2022 16:23:54.7628 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 26446a0b-e450-47f3-a964-08da69a31337 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[12.22.5.238];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT005.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4204 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Implement and expose API that sets the spread of CPUs based on distance, given a NUMA node. Fallback to legacy logic that uses cpumask_local_spread. This logic can be used by device drivers to prefer some remote cpus over others. Reviewed-by: Gal Pressman Signed-off-by: Tariq Toukan --- include/linux/sched/topology.h | 4 +++ kernel/sched/topology.c | 49 ++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) diff --git a/include/linux/sched/topology.h b/include/linux/sched/topology.h index 56cffe42abbc..4fa2e0c61849 100644 --- a/include/linux/sched/topology.h +++ b/include/linux/sched/topology.h @@ -210,6 +210,7 @@ extern void set_sched_topology(struct sched_domain_topology_level *tl); # define SD_INIT_NAME(type) #endif +void sched_cpus_set_spread(int node, u16 *cpus, int ncpus); #else /* CONFIG_SMP */ struct sched_domain_attr; @@ -231,6 +232,9 @@ static inline bool cpus_share_cache(int this_cpu, int that_cpu) return true; } +static inline void sched_cpus_set_spread(int node, u16 *cpus, int ncpus) +{ +} #endif /* !CONFIG_SMP */ #if defined(CONFIG_ENERGY_MODEL) && defined(CONFIG_CPU_FREQ_GOV_SCHEDUTIL) diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c index 05b6c2ad90b9..157aef862c04 100644 --- a/kernel/sched/topology.c +++ b/kernel/sched/topology.c @@ -2067,8 +2067,57 @@ int sched_numa_find_closest(const struct cpumask *cpus, int cpu) return found; } +static bool sched_cpus_spread_by_distance(int node, u16 *cpus, int ncpus) +{ + cpumask_var_t cpumask; + int first, i; + + if (!zalloc_cpumask_var(&cpumask, GFP_KERNEL)) + return false; + + cpumask_copy(cpumask, cpu_online_mask); + + first = cpumask_first(cpumask_of_node(node)); + + for (i = 0; i < ncpus; i++) { + int cpu; + + cpu = sched_numa_find_closest(cpumask, first); + if (cpu >= nr_cpu_ids) { + free_cpumask_var(cpumask); + return false; + } + cpus[i] = cpu; + __cpumask_clear_cpu(cpu, cpumask); + } + + free_cpumask_var(cpumask); + return true; +} +#else +static bool sched_cpus_spread_by_distance(int node, u16 *cpus, int ncpus) +{ + return false; +} #endif /* CONFIG_NUMA */ +static void sched_cpus_by_local_spread(int node, u16 *cpus, int ncpus) +{ + int i; + + for (i = 0; i < ncpus; i++) + cpus[i] = cpumask_local_spread(i, node); +} + +void sched_cpus_set_spread(int node, u16 *cpus, int ncpus) +{ + bool success = sched_cpus_spread_by_distance(node, cpus, ncpus); + + if (!success) + sched_cpus_by_local_spread(node, cpus, ncpus); +} +EXPORT_SYMBOL_GPL(sched_cpus_set_spread); + static int __sdt_alloc(const struct cpumask *cpu_map) { struct sched_domain_topology_level *tl; From patchwork Tue Jul 19 16:23:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tariq Toukan X-Patchwork-Id: 12922730 X-Patchwork-Delegate: kuba@kernel.org 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 5CB4EC433EF for ; Tue, 19 Jul 2022 16:24:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238675AbiGSQYH (ORCPT ); Tue, 19 Jul 2022 12:24:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238606AbiGSQYE (ORCPT ); Tue, 19 Jul 2022 12:24:04 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on20600.outbound.protection.outlook.com [IPv6:2a01:111:f400:7eaa::600]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C7DD5405A; Tue, 19 Jul 2022 09:24:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BVgSrMz7JiqoD0rEuOkNiqOKEfWLpiFubst+zuk+u8sMVIEeMx69/iaG98A6WJjfy4v2sTRY/NlAUk6q7Al/BWRNS9cxkJNvkr/51ad8jTtjtMhMapUVtoVmK0oU/HQ+HzHn6aSQUm3bwDG7kGDt2X+xPvnl9FuvLWt2ELSN92NUCDBvZNX4ibPmwpb+vb2hgOPQLSTYsxJOwVKjXCrW/yvJCyphPhit6IYYz07homy4xVpuFAxn+sU+HPfOxk9lsdZ44MBT6BgR6HsK3ELgRAeZ16s87exFhGxWrmuZSL7BrZGzAMP75hSZLbdEYsnx7kCmEQgt8jUh++wVV+XZTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=C2lMf9nYtTC7ObFBkX9tQCn58+VMFhxBLZpZKx5es9A=; b=jH4kT4zIXHxo4cXq6MmN9CR4t7kwgVOKsL+nJ6b6U8HCCZJNMN7P7cFzXY+NXCMwoHPAtkWeIZY/cvgZaSbntBdAlIbuqPiRCLZBPMyc1I3hB5NlWrCkzMHJDaCCvqV2GQp2lU4JJ+bt9FdRQcz2OMrQyQiJ2ZwYmQ0la0KIsTh8tTFA5UmkzHHMLdgp7bIqwzNsXrpuEAaR+WC+RXu6vLnNMXOfBXeKt0L2crNLzI0NRsJ2ncSMK8+zoPqGheTRFhiGULI/xofOppkoYxto7rOOqbZ6adghHJMrI7ixQM6YDLW73X8Vzy+7RKpZHd2PQh6q+JkRpSUL7MExAZ24IA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.234) smtp.rcpttodomain=redhat.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=C2lMf9nYtTC7ObFBkX9tQCn58+VMFhxBLZpZKx5es9A=; b=HEao6k6xz0+D/izzdI5/TovJRqtigSub/H0o3JAiTSnNtSWkCeiWu40by+qZa/ha2RId27dkyYyTw2KLQah8XmLeNCAiEer/NwuU2V6jHGhygip5u4x+YLtU8rX8Vtu+2X1hoskXnXPMldtVIGpWy9c6TFGKPg6IhlE68AZnvqsuk++Bo5Tv6mRXKDzKjRBlyHSMugN8rbTWN7QeyRvNljD11LLK1tYaXZorIIibinHpauIcapa/J0q8yYdd+vGMyULuNmZDAUshoz1H/90gH/9NmJvc4sQkKx8YtgxqIzP6xPECpWl9x9WWgLrOgqnt56QFAJg8OzhvWfZDzCkv9g== Received: from DM6PR03CA0102.namprd03.prod.outlook.com (2603:10b6:5:333::35) by MN2PR12MB4303.namprd12.prod.outlook.com (2603:10b6:208:198::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.14; Tue, 19 Jul 2022 16:23:58 +0000 Received: from DM6NAM11FT068.eop-nam11.prod.protection.outlook.com (2603:10b6:5:333:cafe::3d) by DM6PR03CA0102.outlook.office365.com (2603:10b6:5:333::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.12 via Frontend Transport; Tue, 19 Jul 2022 16:23:58 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.234) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 12.22.5.234 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.234; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (12.22.5.234) by DM6NAM11FT068.mail.protection.outlook.com (10.13.173.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5438.12 via Frontend Transport; Tue, 19 Jul 2022 16:23:58 +0000 Received: from drhqmail203.nvidia.com (10.126.190.182) by DRHQMAIL101.nvidia.com (10.27.9.10) with Microsoft SMTP Server (TLS) id 15.0.1497.32; Tue, 19 Jul 2022 16:23:57 +0000 Received: from drhqmail203.nvidia.com (10.126.190.182) by drhqmail203.nvidia.com (10.126.190.182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.26; Tue, 19 Jul 2022 09:23:57 -0700 Received: from vdi.nvidia.com (10.127.8.14) by mail.nvidia.com (10.126.190.182) with Microsoft SMTP Server id 15.2.986.26 via Frontend Transport; Tue, 19 Jul 2022 09:23:54 -0700 From: Tariq Toukan To: "David S. Miller" , Saeed Mahameed , Jakub Kicinski , Ingo Molnar , Peter Zijlstra , Juri Lelli CC: Eric Dumazet , Paolo Abeni , , Gal Pressman , Vincent Guittot , , Tariq Toukan Subject: [PATCH net-next V3 2/3] net/mlx5e: Improve remote NUMA preferences used for the IRQ affinity hints Date: Tue, 19 Jul 2022 19:23:38 +0300 Message-ID: <20220719162339.23865-3-tariqt@nvidia.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20220719162339.23865-1-tariqt@nvidia.com> References: <20220719162339.23865-1-tariqt@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c0137442-d461-4f2b-99e0-08da69a3156d X-MS-TrafficTypeDiagnostic: MN2PR12MB4303:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: c/XUyAgfnxPNhGhWu9qGdoD9JxvumAA+kAblvEpqvgkCPGKPCZ7eze0FI6jactTIbqWj6aNQtGfxdP4ZK9AMqSWhemnPalARNSUxzVqKQgtwJ5gQTHm1DqfJW94HGR/rt1NqS2CSv2IuBpHlEy1UZKlhIsAy7quK5V3ebfbZ5vyqLggJEFpRUw7abTPrAPV9T7/4zoDx6qUqMdVlkTmqYd480dfc+IZIjmJDPspQdoxpi1oqZqC//9/9UU8eeY6CSRiqkUY1rPwWwzq9pGp+rdMAtEXMdtEfo7nsIyR7Ee2IPLaS/txKnd/tfTJIyqaW9aJH2VRv0p19GK5VvRIUClB4swaT30VcjZX/qKefEEjYHcMJuQhVL5A0MgQE9CPXtsKnbyDbWlyz5f8tB4B3TU3gwxnHIwJUIxDr8unnaF9jN+0k85SQigaEkUIaIC3hfNoxnKkysIICnvtg8oAhqVJAPjzoj6QBwSJz20+gB23b4EGbz9Ur+Ljn5wOfY/DtSsOJZd1T5DEo7PDpGpQKlSkX6nfprTIVpUULQ2S0MDWueaApTK9ZWk0mFgIn5m4Z1vwlqeCMxg2dmBpY8T8NXE+mStmqhKSGOGaq9cZiXxWnArXBIcrohYCXWd9yHuV4PNNzLciFWMw2aeA3n6X75WcZt1OXKVZeOPC5gycz98liFdybcRzToKK1mp7NofiXx87tHX6hZnh0VufqX8FWweMGwu56ZkbvkKLzva4e0vBQWusaSyBMQPwPyzddH+HHhRyM4urIo0x55tcw4HOUC9kFO9ZdAIlwGVH+jwbX4iFPpMp0yKfFHvBulh8qIyCt9RewJh2ISmApMeblv3P9PQ== X-Forefront-Antispam-Report: CIP:12.22.5.234;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:InfoNoRecords;CAT:NONE;SFS:(13230016)(4636009)(39860400002)(376002)(346002)(396003)(136003)(46966006)(40470700004)(36840700001)(83380400001)(41300700001)(356005)(426003)(7416002)(2906002)(82310400005)(81166007)(8936002)(107886003)(336012)(36756003)(5660300002)(186003)(47076005)(2616005)(26005)(30864003)(1076003)(7696005)(40480700001)(36860700001)(6666004)(478600001)(8676002)(86362001)(82740400003)(4326008)(316002)(110136005)(70586007)(70206006)(54906003)(40460700003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jul 2022 16:23:58.4874 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c0137442-d461-4f2b-99e0-08da69a3156d X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[12.22.5.234];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT068.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4303 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org In the IRQ affinity hints, replace the binary NUMA preference (local / remote) with an improved API that minds the actual distances, so that remote NUMAs with short distance are preferred over farther ones. This has significant performance implications when using NUMA-aware allocated memory (follow [1] and derivatives for example). [1] drivers/net/ethernet/mellanox/mlx5/core/en_main.c :: mlx5e_open_channel() int cpu = cpumask_first(mlx5_comp_irq_get_affinity_mask(priv->mdev, ix)); Performance tests: 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. * CPU util on active cores only. Setups details (similar for both sides): NIC: ConnectX6-DX dual port, 100 Gbps each. Single port used in the tests. $ lscpu Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian CPU(s): 256 On-line CPU(s) list: 0-255 Thread(s) per core: 2 Core(s) per socket: 64 Socket(s): 2 NUMA node(s): 16 Vendor ID: AuthenticAMD CPU family: 25 Model: 1 Model name: AMD EPYC 7763 64-Core Processor Stepping: 1 CPU MHz: 2594.804 BogoMIPS: 4890.73 Virtualization: AMD-V L1d cache: 32K L1i cache: 32K L2 cache: 512K L3 cache: 32768K NUMA node0 CPU(s): 0-7,128-135 NUMA node1 CPU(s): 8-15,136-143 NUMA node2 CPU(s): 16-23,144-151 NUMA node3 CPU(s): 24-31,152-159 NUMA node4 CPU(s): 32-39,160-167 NUMA node5 CPU(s): 40-47,168-175 NUMA node6 CPU(s): 48-55,176-183 NUMA node7 CPU(s): 56-63,184-191 NUMA node8 CPU(s): 64-71,192-199 NUMA node9 CPU(s): 72-79,200-207 NUMA node10 CPU(s): 80-87,208-215 NUMA node11 CPU(s): 88-95,216-223 NUMA node12 CPU(s): 96-103,224-231 NUMA node13 CPU(s): 104-111,232-239 NUMA node14 CPU(s): 112-119,240-247 NUMA node15 CPU(s): 120-127,248-255 .. $ numactl -H .. node distances: node 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 0: 10 11 11 11 12 12 12 12 32 32 32 32 32 32 32 32 1: 11 10 11 11 12 12 12 12 32 32 32 32 32 32 32 32 2: 11 11 10 11 12 12 12 12 32 32 32 32 32 32 32 32 3: 11 11 11 10 12 12 12 12 32 32 32 32 32 32 32 32 4: 12 12 12 12 10 11 11 11 32 32 32 32 32 32 32 32 5: 12 12 12 12 11 10 11 11 32 32 32 32 32 32 32 32 6: 12 12 12 12 11 11 10 11 32 32 32 32 32 32 32 32 7: 12 12 12 12 11 11 11 10 32 32 32 32 32 32 32 32 8: 32 32 32 32 32 32 32 32 10 11 11 11 12 12 12 12 9: 32 32 32 32 32 32 32 32 11 10 11 11 12 12 12 12 10: 32 32 32 32 32 32 32 32 11 11 10 11 12 12 12 12 11: 32 32 32 32 32 32 32 32 11 11 11 10 12 12 12 12 12: 32 32 32 32 32 32 32 32 12 12 12 12 10 11 11 11 13: 32 32 32 32 32 32 32 32 12 12 12 12 11 10 11 11 14: 32 32 32 32 32 32 32 32 12 12 12 12 11 11 10 11 15: 32 32 32 32 32 32 32 32 12 12 12 12 11 11 11 10 $ cat /sys/class/net/ens5f0/device/numa_node 14 Affinity hints (127 IRQs): Before: 331: 00000000,00000000,00000000,00000000,00010000,00000000,00000000,00000000 332: 00000000,00000000,00000000,00000000,00020000,00000000,00000000,00000000 333: 00000000,00000000,00000000,00000000,00040000,00000000,00000000,00000000 334: 00000000,00000000,00000000,00000000,00080000,00000000,00000000,00000000 335: 00000000,00000000,00000000,00000000,00100000,00000000,00000000,00000000 336: 00000000,00000000,00000000,00000000,00200000,00000000,00000000,00000000 337: 00000000,00000000,00000000,00000000,00400000,00000000,00000000,00000000 338: 00000000,00000000,00000000,00000000,00800000,00000000,00000000,00000000 339: 00010000,00000000,00000000,00000000,00000000,00000000,00000000,00000000 340: 00020000,00000000,00000000,00000000,00000000,00000000,00000000,00000000 341: 00040000,00000000,00000000,00000000,00000000,00000000,00000000,00000000 342: 00080000,00000000,00000000,00000000,00000000,00000000,00000000,00000000 343: 00100000,00000000,00000000,00000000,00000000,00000000,00000000,00000000 344: 00200000,00000000,00000000,00000000,00000000,00000000,00000000,00000000 345: 00400000,00000000,00000000,00000000,00000000,00000000,00000000,00000000 346: 00800000,00000000,00000000,00000000,00000000,00000000,00000000,00000000 347: 00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000001 348: 00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000002 349: 00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000004 350: 00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000008 351: 00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000010 352: 00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000020 353: 00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000040 354: 00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000080 355: 00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000100 356: 00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000200 357: 00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000400 358: 00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000800 359: 00000000,00000000,00000000,00000000,00000000,00000000,00000000,00001000 360: 00000000,00000000,00000000,00000000,00000000,00000000,00000000,00002000 361: 00000000,00000000,00000000,00000000,00000000,00000000,00000000,00004000 362: 00000000,00000000,00000000,00000000,00000000,00000000,00000000,00008000 363: 00000000,00000000,00000000,00000000,00000000,00000000,00000000,00010000 364: 00000000,00000000,00000000,00000000,00000000,00000000,00000000,00020000 365: 00000000,00000000,00000000,00000000,00000000,00000000,00000000,00040000 366: 00000000,00000000,00000000,00000000,00000000,00000000,00000000,00080000 367: 00000000,00000000,00000000,00000000,00000000,00000000,00000000,00100000 368: 00000000,00000000,00000000,00000000,00000000,00000000,00000000,00200000 369: 00000000,00000000,00000000,00000000,00000000,00000000,00000000,00400000 370: 00000000,00000000,00000000,00000000,00000000,00000000,00000000,00800000 371: 00000000,00000000,00000000,00000000,00000000,00000000,00000000,01000000 372: 00000000,00000000,00000000,00000000,00000000,00000000,00000000,02000000 373: 00000000,00000000,00000000,00000000,00000000,00000000,00000000,04000000 374: 00000000,00000000,00000000,00000000,00000000,00000000,00000000,08000000 375: 00000000,00000000,00000000,00000000,00000000,00000000,00000000,10000000 376: 00000000,00000000,00000000,00000000,00000000,00000000,00000000,20000000 377: 00000000,00000000,00000000,00000000,00000000,00000000,00000000,40000000 378: 00000000,00000000,00000000,00000000,00000000,00000000,00000000,80000000 379: 00000000,00000000,00000000,00000000,00000000,00000000,00000001,00000000 380: 00000000,00000000,00000000,00000000,00000000,00000000,00000002,00000000 381: 00000000,00000000,00000000,00000000,00000000,00000000,00000004,00000000 382: 00000000,00000000,00000000,00000000,00000000,00000000,00000008,00000000 383: 00000000,00000000,00000000,00000000,00000000,00000000,00000010,00000000 384: 00000000,00000000,00000000,00000000,00000000,00000000,00000020,00000000 385: 00000000,00000000,00000000,00000000,00000000,00000000,00000040,00000000 386: 00000000,00000000,00000000,00000000,00000000,00000000,00000080,00000000 387: 00000000,00000000,00000000,00000000,00000000,00000000,00000100,00000000 388: 00000000,00000000,00000000,00000000,00000000,00000000,00000200,00000000 389: 00000000,00000000,00000000,00000000,00000000,00000000,00000400,00000000 390: 00000000,00000000,00000000,00000000,00000000,00000000,00000800,00000000 391: 00000000,00000000,00000000,00000000,00000000,00000000,00001000,00000000 392: 00000000,00000000,00000000,00000000,00000000,00000000,00002000,00000000 393: 00000000,00000000,00000000,00000000,00000000,00000000,00004000,00000000 394: 00000000,00000000,00000000,00000000,00000000,00000000,00008000,00000000 395: 00000000,00000000,00000000,00000000,00000000,00000000,00010000,00000000 396: 00000000,00000000,00000000,00000000,00000000,00000000,00020000,00000000 397: 00000000,00000000,00000000,00000000,00000000,00000000,00040000,00000000 398: 00000000,00000000,00000000,00000000,00000000,00000000,00080000,00000000 399: 00000000,00000000,00000000,00000000,00000000,00000000,00100000,00000000 400: 00000000,00000000,00000000,00000000,00000000,00000000,00200000,00000000 401: 00000000,00000000,00000000,00000000,00000000,00000000,00400000,00000000 402: 00000000,00000000,00000000,00000000,00000000,00000000,00800000,00000000 403: 00000000,00000000,00000000,00000000,00000000,00000000,01000000,00000000 404: 00000000,00000000,00000000,00000000,00000000,00000000,02000000,00000000 405: 00000000,00000000,00000000,00000000,00000000,00000000,04000000,00000000 406: 00000000,00000000,00000000,00000000,00000000,00000000,08000000,00000000 407: 00000000,00000000,00000000,00000000,00000000,00000000,10000000,00000000 408: 00000000,00000000,00000000,00000000,00000000,00000000,20000000,00000000 409: 00000000,00000000,00000000,00000000,00000000,00000000,40000000,00000000 410: 00000000,00000000,00000000,00000000,00000000,00000000,80000000,00000000 411: 00000000,00000000,00000000,00000000,00000000,00000001,00000000,00000000 412: 00000000,00000000,00000000,00000000,00000000,00000002,00000000,00000000 413: 00000000,00000000,00000000,00000000,00000000,00000004,00000000,00000000 414: 00000000,00000000,00000000,00000000,00000000,00000008,00000000,00000000 415: 00000000,00000000,00000000,00000000,00000000,00000010,00000000,00000000 416: 00000000,00000000,00000000,00000000,00000000,00000020,00000000,00000000 417: 00000000,00000000,00000000,00000000,00000000,00000040,00000000,00000000 418: 00000000,00000000,00000000,00000000,00000000,00000080,00000000,00000000 419: 00000000,00000000,00000000,00000000,00000000,00000100,00000000,00000000 420: 00000000,00000000,00000000,00000000,00000000,00000200,00000000,00000000 421: 00000000,00000000,00000000,00000000,00000000,00000400,00000000,00000000 422: 00000000,00000000,00000000,00000000,00000000,00000800,00000000,00000000 423: 00000000,00000000,00000000,00000000,00000000,00001000,00000000,00000000 424: 00000000,00000000,00000000,00000000,00000000,00002000,00000000,00000000 425: 00000000,00000000,00000000,00000000,00000000,00004000,00000000,00000000 426: 00000000,00000000,00000000,00000000,00000000,00008000,00000000,00000000 427: 00000000,00000000,00000000,00000000,00000000,00010000,00000000,00000000 428: 00000000,00000000,00000000,00000000,00000000,00020000,00000000,00000000 429: 00000000,00000000,00000000,00000000,00000000,00040000,00000000,00000000 430: 00000000,00000000,00000000,00000000,00000000,00080000,00000000,00000000 431: 00000000,00000000,00000000,00000000,00000000,00100000,00000000,00000000 432: 00000000,00000000,00000000,00000000,00000000,00200000,00000000,00000000 433: 00000000,00000000,00000000,00000000,00000000,00400000,00000000,00000000 434: 00000000,00000000,00000000,00000000,00000000,00800000,00000000,00000000 435: 00000000,00000000,00000000,00000000,00000000,01000000,00000000,00000000 436: 00000000,00000000,00000000,00000000,00000000,02000000,00000000,00000000 437: 00000000,00000000,00000000,00000000,00000000,04000000,00000000,00000000 438: 00000000,00000000,00000000,00000000,00000000,08000000,00000000,00000000 439: 00000000,00000000,00000000,00000000,00000000,10000000,00000000,00000000 440: 00000000,00000000,00000000,00000000,00000000,20000000,00000000,00000000 441: 00000000,00000000,00000000,00000000,00000000,40000000,00000000,00000000 442: 00000000,00000000,00000000,00000000,00000000,80000000,00000000,00000000 443: 00000000,00000000,00000000,00000000,00000001,00000000,00000000,00000000 444: 00000000,00000000,00000000,00000000,00000002,00000000,00000000,00000000 445: 00000000,00000000,00000000,00000000,00000004,00000000,00000000,00000000 446: 00000000,00000000,00000000,00000000,00000008,00000000,00000000,00000000 447: 00000000,00000000,00000000,00000000,00000010,00000000,00000000,00000000 448: 00000000,00000000,00000000,00000000,00000020,00000000,00000000,00000000 449: 00000000,00000000,00000000,00000000,00000040,00000000,00000000,00000000 450: 00000000,00000000,00000000,00000000,00000080,00000000,00000000,00000000 451: 00000000,00000000,00000000,00000000,00000100,00000000,00000000,00000000 452: 00000000,00000000,00000000,00000000,00000200,00000000,00000000,00000000 453: 00000000,00000000,00000000,00000000,00000400,00000000,00000000,00000000 454: 00000000,00000000,00000000,00000000,00000800,00000000,00000000,00000000 455: 00000000,00000000,00000000,00000000,00001000,00000000,00000000,00000000 456: 00000000,00000000,00000000,00000000,00002000,00000000,00000000,00000000 457: 00000000,00000000,00000000,00000000,00004000,00000000,00000000,00000000 After: 331: 00000000,00000000,00000000,00000000,00010000,00000000,00000000,00000000 332: 00000000,00000000,00000000,00000000,00020000,00000000,00000000,00000000 333: 00000000,00000000,00000000,00000000,00040000,00000000,00000000,00000000 334: 00000000,00000000,00000000,00000000,00080000,00000000,00000000,00000000 335: 00000000,00000000,00000000,00000000,00100000,00000000,00000000,00000000 336: 00000000,00000000,00000000,00000000,00200000,00000000,00000000,00000000 337: 00000000,00000000,00000000,00000000,00400000,00000000,00000000,00000000 338: 00000000,00000000,00000000,00000000,00800000,00000000,00000000,00000000 339: 00010000,00000000,00000000,00000000,00000000,00000000,00000000,00000000 340: 00020000,00000000,00000000,00000000,00000000,00000000,00000000,00000000 341: 00040000,00000000,00000000,00000000,00000000,00000000,00000000,00000000 342: 00080000,00000000,00000000,00000000,00000000,00000000,00000000,00000000 343: 00100000,00000000,00000000,00000000,00000000,00000000,00000000,00000000 344: 00200000,00000000,00000000,00000000,00000000,00000000,00000000,00000000 345: 00400000,00000000,00000000,00000000,00000000,00000000,00000000,00000000 346: 00800000,00000000,00000000,00000000,00000000,00000000,00000000,00000000 347: 00000000,00000000,00000000,00000000,00000001,00000000,00000000,00000000 348: 00000000,00000000,00000000,00000000,00000002,00000000,00000000,00000000 349: 00000000,00000000,00000000,00000000,00000004,00000000,00000000,00000000 350: 00000000,00000000,00000000,00000000,00000008,00000000,00000000,00000000 351: 00000000,00000000,00000000,00000000,00000010,00000000,00000000,00000000 352: 00000000,00000000,00000000,00000000,00000020,00000000,00000000,00000000 353: 00000000,00000000,00000000,00000000,00000040,00000000,00000000,00000000 354: 00000000,00000000,00000000,00000000,00000080,00000000,00000000,00000000 355: 00000000,00000000,00000000,00000000,00000100,00000000,00000000,00000000 356: 00000000,00000000,00000000,00000000,00000200,00000000,00000000,00000000 357: 00000000,00000000,00000000,00000000,00000400,00000000,00000000,00000000 358: 00000000,00000000,00000000,00000000,00000800,00000000,00000000,00000000 359: 00000000,00000000,00000000,00000000,00001000,00000000,00000000,00000000 360: 00000000,00000000,00000000,00000000,00002000,00000000,00000000,00000000 361: 00000000,00000000,00000000,00000000,00004000,00000000,00000000,00000000 362: 00000000,00000000,00000000,00000000,00008000,00000000,00000000,00000000 363: 00000000,00000000,00000000,00000000,01000000,00000000,00000000,00000000 364: 00000000,00000000,00000000,00000000,02000000,00000000,00000000,00000000 365: 00000000,00000000,00000000,00000000,04000000,00000000,00000000,00000000 366: 00000000,00000000,00000000,00000000,08000000,00000000,00000000,00000000 367: 00000000,00000000,00000000,00000000,10000000,00000000,00000000,00000000 368: 00000000,00000000,00000000,00000000,20000000,00000000,00000000,00000000 369: 00000000,00000000,00000000,00000000,40000000,00000000,00000000,00000000 370: 00000000,00000000,00000000,00000000,80000000,00000000,00000000,00000000 371: 00000001,00000000,00000000,00000000,00000000,00000000,00000000,00000000 372: 00000002,00000000,00000000,00000000,00000000,00000000,00000000,00000000 373: 00000004,00000000,00000000,00000000,00000000,00000000,00000000,00000000 374: 00000008,00000000,00000000,00000000,00000000,00000000,00000000,00000000 375: 00000010,00000000,00000000,00000000,00000000,00000000,00000000,00000000 376: 00000020,00000000,00000000,00000000,00000000,00000000,00000000,00000000 377: 00000040,00000000,00000000,00000000,00000000,00000000,00000000,00000000 378: 00000080,00000000,00000000,00000000,00000000,00000000,00000000,00000000 379: 00000100,00000000,00000000,00000000,00000000,00000000,00000000,00000000 380: 00000200,00000000,00000000,00000000,00000000,00000000,00000000,00000000 381: 00000400,00000000,00000000,00000000,00000000,00000000,00000000,00000000 382: 00000800,00000000,00000000,00000000,00000000,00000000,00000000,00000000 383: 00001000,00000000,00000000,00000000,00000000,00000000,00000000,00000000 384: 00002000,00000000,00000000,00000000,00000000,00000000,00000000,00000000 385: 00004000,00000000,00000000,00000000,00000000,00000000,00000000,00000000 386: 00008000,00000000,00000000,00000000,00000000,00000000,00000000,00000000 387: 01000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000 388: 02000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000 389: 04000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000 390: 08000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000 391: 10000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000 392: 20000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000 393: 40000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000 394: 80000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000 395: 00000000,00000000,00000000,00000000,00000000,00000001,00000000,00000000 396: 00000000,00000000,00000000,00000000,00000000,00000002,00000000,00000000 397: 00000000,00000000,00000000,00000000,00000000,00000004,00000000,00000000 398: 00000000,00000000,00000000,00000000,00000000,00000008,00000000,00000000 399: 00000000,00000000,00000000,00000000,00000000,00000010,00000000,00000000 400: 00000000,00000000,00000000,00000000,00000000,00000020,00000000,00000000 401: 00000000,00000000,00000000,00000000,00000000,00000040,00000000,00000000 402: 00000000,00000000,00000000,00000000,00000000,00000080,00000000,00000000 403: 00000000,00000000,00000000,00000000,00000000,00000100,00000000,00000000 404: 00000000,00000000,00000000,00000000,00000000,00000200,00000000,00000000 405: 00000000,00000000,00000000,00000000,00000000,00000400,00000000,00000000 406: 00000000,00000000,00000000,00000000,00000000,00000800,00000000,00000000 407: 00000000,00000000,00000000,00000000,00000000,00001000,00000000,00000000 408: 00000000,00000000,00000000,00000000,00000000,00002000,00000000,00000000 409: 00000000,00000000,00000000,00000000,00000000,00004000,00000000,00000000 410: 00000000,00000000,00000000,00000000,00000000,00008000,00000000,00000000 411: 00000000,00000000,00000000,00000000,00000000,00010000,00000000,00000000 412: 00000000,00000000,00000000,00000000,00000000,00020000,00000000,00000000 413: 00000000,00000000,00000000,00000000,00000000,00040000,00000000,00000000 414: 00000000,00000000,00000000,00000000,00000000,00080000,00000000,00000000 415: 00000000,00000000,00000000,00000000,00000000,00100000,00000000,00000000 416: 00000000,00000000,00000000,00000000,00000000,00200000,00000000,00000000 417: 00000000,00000000,00000000,00000000,00000000,00400000,00000000,00000000 418: 00000000,00000000,00000000,00000000,00000000,00800000,00000000,00000000 419: 00000000,00000000,00000000,00000000,00000000,01000000,00000000,00000000 420: 00000000,00000000,00000000,00000000,00000000,02000000,00000000,00000000 421: 00000000,00000000,00000000,00000000,00000000,04000000,00000000,00000000 422: 00000000,00000000,00000000,00000000,00000000,08000000,00000000,00000000 423: 00000000,00000000,00000000,00000000,00000000,10000000,00000000,00000000 424: 00000000,00000000,00000000,00000000,00000000,20000000,00000000,00000000 425: 00000000,00000000,00000000,00000000,00000000,40000000,00000000,00000000 426: 00000000,00000000,00000000,00000000,00000000,80000000,00000000,00000000 427: 00000000,00000001,00000000,00000000,00000000,00000000,00000000,00000000 428: 00000000,00000002,00000000,00000000,00000000,00000000,00000000,00000000 429: 00000000,00000004,00000000,00000000,00000000,00000000,00000000,00000000 430: 00000000,00000008,00000000,00000000,00000000,00000000,00000000,00000000 431: 00000000,00000010,00000000,00000000,00000000,00000000,00000000,00000000 432: 00000000,00000020,00000000,00000000,00000000,00000000,00000000,00000000 433: 00000000,00000040,00000000,00000000,00000000,00000000,00000000,00000000 434: 00000000,00000080,00000000,00000000,00000000,00000000,00000000,00000000 435: 00000000,00000100,00000000,00000000,00000000,00000000,00000000,00000000 436: 00000000,00000200,00000000,00000000,00000000,00000000,00000000,00000000 437: 00000000,00000400,00000000,00000000,00000000,00000000,00000000,00000000 438: 00000000,00000800,00000000,00000000,00000000,00000000,00000000,00000000 439: 00000000,00001000,00000000,00000000,00000000,00000000,00000000,00000000 440: 00000000,00002000,00000000,00000000,00000000,00000000,00000000,00000000 441: 00000000,00004000,00000000,00000000,00000000,00000000,00000000,00000000 442: 00000000,00008000,00000000,00000000,00000000,00000000,00000000,00000000 443: 00000000,00010000,00000000,00000000,00000000,00000000,00000000,00000000 444: 00000000,00020000,00000000,00000000,00000000,00000000,00000000,00000000 445: 00000000,00040000,00000000,00000000,00000000,00000000,00000000,00000000 446: 00000000,00080000,00000000,00000000,00000000,00000000,00000000,00000000 447: 00000000,00100000,00000000,00000000,00000000,00000000,00000000,00000000 448: 00000000,00200000,00000000,00000000,00000000,00000000,00000000,00000000 449: 00000000,00400000,00000000,00000000,00000000,00000000,00000000,00000000 450: 00000000,00800000,00000000,00000000,00000000,00000000,00000000,00000000 451: 00000000,01000000,00000000,00000000,00000000,00000000,00000000,00000000 452: 00000000,02000000,00000000,00000000,00000000,00000000,00000000,00000000 453: 00000000,04000000,00000000,00000000,00000000,00000000,00000000,00000000 454: 00000000,08000000,00000000,00000000,00000000,00000000,00000000,00000000 455: 00000000,10000000,00000000,00000000,00000000,00000000,00000000,00000000 456: 00000000,20000000,00000000,00000000,00000000,00000000,00000000,00000000 457: 00000000,40000000,00000000,00000000,00000000,00000000,00000000,00000000 Reviewed-by: Gal Pressman Acked-by: Saeed Mahameed Signed-off-by: Tariq Toukan --- drivers/net/ethernet/mellanox/mlx5/core/eq.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eq.c b/drivers/net/ethernet/mellanox/mlx5/core/eq.c index 229728c80233..e78fb82d5be8 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eq.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eq.c @@ -11,6 +11,7 @@ #ifdef CONFIG_RFS_ACCEL #include #endif +#include #include "mlx5_core.h" #include "lib/eq.h" #include "fpga/core.h" @@ -812,7 +813,6 @@ static int comp_irqs_request(struct mlx5_core_dev *dev) int ncomp_eqs = table->num_comp_eqs; u16 *cpus; int ret; - int i; ncomp_eqs = table->num_comp_eqs; table->comp_irqs = kcalloc(ncomp_eqs, sizeof(*table->comp_irqs), GFP_KERNEL); @@ -830,8 +830,7 @@ static int comp_irqs_request(struct mlx5_core_dev *dev) ret = -ENOMEM; goto free_irqs; } - for (i = 0; i < ncomp_eqs; i++) - cpus[i] = cpumask_local_spread(i, dev->priv.numa_node); + sched_cpus_set_spread(dev->priv.numa_node, cpus, ncomp_eqs); ret = mlx5_irqs_request_vectors(dev, cpus, ncomp_eqs, table->comp_irqs); kfree(cpus); if (ret < 0) From patchwork Tue Jul 19 16:23:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tariq Toukan X-Patchwork-Id: 12922731 X-Patchwork-Delegate: kuba@kernel.org 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 0ADA3C433EF for ; Tue, 19 Jul 2022 16:24:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238791AbiGSQYU (ORCPT ); Tue, 19 Jul 2022 12:24:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238843AbiGSQYK (ORCPT ); Tue, 19 Jul 2022 12:24:10 -0400 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2087.outbound.protection.outlook.com [40.107.95.87]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83C97550BA; Tue, 19 Jul 2022 09:24:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lG+saKlcgrq6fYRdmytuf8cyS++JC9g1NaBeIv7dA+LEFQAi2F3MlzJgTSlFH5jUcjCR6a34J+f0kVF8E0spM7YtSbVEyUDhg0yICy10FHamr3alztn3OwvgeaNVWLjNWqij7UzBzEunwq31DVFYN1kmQXMEunK2GLRF6hkcifeNh5ld/l0gWIGn5AorZWG8aWUUVvkq8nOEEItms6IHhhbtLR4hBM2avXFCY1Va3y4Qb5N6jeXi6YxmbS+TfXWl5fscI1ik2u5oa+H4OOW4bGsQXK3ZE0xKXNCPeAlXyNTIVTVj2xYcZK7T6eMPOab9bEe+FTf9iSbjYWOgp/a/Dg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=/cLQU7+nU5eOwT7QayClX4EbG5c4mI67Su2od66AifM=; b=MTJru607GO85kcxmPIL6tTLqUx1HAFLkeTCnQERwS0uSUcO5snHFcwjttbKAoukpWCa1VGAQw/StyEDcN3XBUnIn+pRJf+lp9WS+FapnR8ZxqMHzb3HeCKX/xfThck27sbg3F/L/4MxMNvpgaaj3o9Zt98dbHXhwY/Jp0fh2PbDfnD6XGkWeaE24aj3Zh0FCxbIb9d9rHENxt5UD28OVaQ3ciuiVokXRGpBVCD7K0FYczvgx8RsYKecc/y2xIaymkdKAwrl6eDDykkh68Ynjv6FmiEsv8Gn30zfQ8pXwmYMKA8mYc0/k21Q2M/escndzmquu0dbmRJk10GYa80BV9g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.236) smtp.rcpttodomain=linaro.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/cLQU7+nU5eOwT7QayClX4EbG5c4mI67Su2od66AifM=; b=NBX98jgzgdNdqHST4QHIQn4ZHjGqdNFLbHOhRtRaL1EhOGgm2uRlPamjD5kbU+92o+RKmCit7H3R2IYuuIWcJI/3/xvb8eEzQMjCpK+dMPnevXIuCD6aRbXip8SEyD9h8IZTb08O8UkQTg+k3S4k2NB4iINVZmjQxaGP15kiRq8wG+I177WnkPEnWqY0WUD5+CTdPXFFn5zb06hJz3pVgygLcbXnZBbdrv+0/YWRjF6tTNE/3FztfP4SVZgeDEz+b0otvvEyIornZy0rT5TguwbUmfGTg2snReBc67NIj0jW1sfbRhsMD/ypOPMm7gA2jRsI51CyUkx1ZRif4dMhvQ== Received: from BN9PR03CA0977.namprd03.prod.outlook.com (2603:10b6:408:109::22) by DM6PR12MB4636.namprd12.prod.outlook.com (2603:10b6:5:161::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.17; Tue, 19 Jul 2022 16:24:02 +0000 Received: from BN8NAM11FT035.eop-nam11.prod.protection.outlook.com (2603:10b6:408:109:cafe::6e) by BN9PR03CA0977.outlook.office365.com (2603:10b6:408:109::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.20 via Frontend Transport; Tue, 19 Jul 2022 16:24:02 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.236) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 12.22.5.236 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.236; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (12.22.5.236) by BN8NAM11FT035.mail.protection.outlook.com (10.13.177.116) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5438.12 via Frontend Transport; Tue, 19 Jul 2022 16:24:02 +0000 Received: from drhqmail203.nvidia.com (10.126.190.182) by DRHQMAIL109.nvidia.com (10.27.9.19) with Microsoft SMTP Server (TLS) id 15.0.1497.32; Tue, 19 Jul 2022 16:24:01 +0000 Received: from drhqmail203.nvidia.com (10.126.190.182) by drhqmail203.nvidia.com (10.126.190.182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.26; Tue, 19 Jul 2022 09:24:01 -0700 Received: from vdi.nvidia.com (10.127.8.14) by mail.nvidia.com (10.126.190.182) with Microsoft SMTP Server id 15.2.986.26 via Frontend Transport; Tue, 19 Jul 2022 09:23:57 -0700 From: Tariq Toukan To: "David S. Miller" , Saeed Mahameed , Jakub Kicinski , Ingo Molnar , Peter Zijlstra , Juri Lelli CC: Eric Dumazet , Paolo Abeni , , Gal Pressman , Vincent Guittot , , Tariq Toukan , Christian Benvenuti , "Govindarajulu Varadarajan" <_govind@gmx.com> Subject: [PATCH net-next V3 3/3] enic: Use NUMA distances logic when setting affinity hints Date: Tue, 19 Jul 2022 19:23:39 +0300 Message-ID: <20220719162339.23865-4-tariqt@nvidia.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20220719162339.23865-1-tariqt@nvidia.com> References: <20220719162339.23865-1-tariqt@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ced6d237-9f4c-4da4-562a-08da69a317e3 X-MS-TrafficTypeDiagnostic: DM6PR12MB4636:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4IbbyILciQ1e08Q49Hvuqy23lrRTDJA8aPG/97KIkdFkywCfs5cP+24SyNl1hdAQytSKr8uoDIElxDg5uX3z0lG4g6dBrHRxYfLss5h1F1qEN/121PlNHdoOa0dEsbY8mluEoz8pkJPy2JYjlhI917UHbZl+mygcRsiincuEcSIQ7Wzd1HTwEiXef4b5W8Rnpu7fQ+qLpqXWFP/vMqvgjtSHiITQQaH8wxIcWmdIjmEwNUHT+KCjMLaiyaStJjnEyOWH9qBMfPjh/aaWLMnLm97nbUY/bHArm0N/j7AGxmoxg/1mywOxYQtArwVTK6rAl1IBvGGLihVRGQ4FIx3vOB+mYUeTvvyjbZg2NH0fzaW+PY0hHmByuEy8WYiJ2P++/yt/caDY/9HmRp6YUFDjg8MOUKuequ1/ZsazqOdE+IXnNSSxv7zunwgoeLgG3/rXs+luMF6oJy7j65tftzDMiLVtpGtEkeb1HxIc3OxT4Pe/j3IiSR66QqtmnAvOhgf+f/xInnSkZ1cmfAj6pSeH4/IbHnyzXHkAF7e6TpL57w7tfimf1TRzRc7XOvgbb0F5/tFPX92bqPezP2chU+V7RYODeVysXD0PSASflEZbA2NXHu/0iFoFUPXts3sQM51z0KwTjNvwXJt2yKlUn+7PnvyDOJMNfIbxioKFsEHeleUk9zhGr1Hm0X1npdAeCR84mMcSrfN19OLaCbxHObNvwRxNsGdTNyfAez2tu7HE4npmwUXrNQWkw4p/a+utnxGn7UtgR9I+ZRjbRzMjVwcPlxjzaG0J9P2vsPEMGVaadg6XAHoNuzcSHQTyZxZC7a/XW8pLHxkkxB6iBdS8ktlEvB1wVKe2vE9bVFCRwyzlH80= X-Forefront-Antispam-Report: CIP:12.22.5.236;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:InfoNoRecords;CAT:NONE;SFS:(13230016)(4636009)(376002)(136003)(346002)(39860400002)(396003)(46966006)(36840700001)(40470700004)(54906003)(478600001)(110136005)(41300700001)(6666004)(7696005)(26005)(2906002)(40480700001)(8936002)(316002)(8676002)(82310400005)(5660300002)(2616005)(4326008)(7416002)(70586007)(83380400001)(36860700001)(356005)(36756003)(82740400003)(40460700003)(70206006)(47076005)(336012)(426003)(1076003)(81166007)(86362001)(186003)(518174003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jul 2022 16:24:02.5832 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ced6d237-9f4c-4da4-562a-08da69a317e3 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[12.22.5.236];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT035.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4636 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Use the new CPU spread API to sort cpus preference of remote NUMA nodes according to their distance. Cc: Christian Benvenuti Cc: Govindarajulu Varadarajan <_govind@gmx.com> Reviewed-by: Gal Pressman Signed-off-by: Tariq Toukan --- drivers/net/ethernet/cisco/enic/enic_main.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/ethernet/cisco/enic/enic_main.c index 372fb7b3a282..9de3c3ffa1e3 100644 --- a/drivers/net/ethernet/cisco/enic/enic_main.c +++ b/drivers/net/ethernet/cisco/enic/enic_main.c @@ -44,6 +44,7 @@ #include #endif #include +#include #include #include @@ -114,8 +115,14 @@ static struct enic_intr_mod_range mod_range[ENIC_MAX_LINK_SPEEDS] = { static void enic_init_affinity_hint(struct enic *enic) { int numa_node = dev_to_node(&enic->pdev->dev); + u16 *cpus; int i; + cpus = kcalloc(enic->intr_count, sizeof(*cpus), GFP_KERNEL); + if (!cpus) + return; + + sched_cpus_set_spread(numa_node, cpus, enic->intr_count); for (i = 0; i < enic->intr_count; i++) { if (enic_is_err_intr(enic, i) || enic_is_notify_intr(enic, i) || (cpumask_available(enic->msix[i].affinity_mask) && @@ -123,9 +130,10 @@ static void enic_init_affinity_hint(struct enic *enic) continue; if (zalloc_cpumask_var(&enic->msix[i].affinity_mask, GFP_KERNEL)) - cpumask_set_cpu(cpumask_local_spread(i, numa_node), + cpumask_set_cpu(cpus[i], enic->msix[i].affinity_mask); } + kfree(cpus); } static void enic_free_affinity_hint(struct enic *enic)