From patchwork Thu Jul 28 19:12:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tariq Toukan X-Patchwork-Id: 12931694 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 4DA39C04A68 for ; Thu, 28 Jul 2022 19:12:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232864AbiG1TMd (ORCPT ); Thu, 28 Jul 2022 15:12:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229619AbiG1TMX (ORCPT ); Thu, 28 Jul 2022 15:12:23 -0400 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2064.outbound.protection.outlook.com [40.107.92.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97012691C0; Thu, 28 Jul 2022 12:12:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KIsjP/70DVZoJw30aqAhC0An72p+9pnQ0X0HetrxJPbTws4rL9BeZn5HqdBhs1F9mow01IWknmNS0jUKiF89Hk7K2VKjga/LJ6b9YRHJCzCqElHLasLztj96nBpSkur5Hw1Wv/gPgilPWtV2LdXsbwaDH6Ps8HNnND13Yw0XHPj5WVZc5L1KqFqIgmatwoOTNrlA2QqZn87xR8I3NaD0kEZfOw3lkufzZOJDzIhWNWFNry434q1Ad8pCVO/e5kA/4bkMFtZrXqLh+oKhE1qXpSF1B2z2Sd9BacEqAHJdtxNJ8YDgG4QchfZ7OrgIpxVqdt9K9vO6Z4DFoMvFMdijAw== 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=Eu+nGm2R1Rw980cLUiROtpKsrrUD8sKB3+Ltxmyk4ds=; b=brQsGh2L5w0TUS+U6Yt8xPxs2gx1vKMZK+n9DhK50+RUhl+xTtdCXNzPURSQZYa4SqsM0LA9B+qDJeFBXR0Mr1QSvdbW73ST6hBg2+vCX9Vg0qF7Q8NqDUKupAJX1RVfUjfNNds+TQU6+Sgbj46o4uRQVrndcIlnm157v8Y/gd4mW5eSOBeysrwcQgkVVTvT1u1IiognV4PoXZILFObWgdV4rAtZ7rt2/AtE7mvmeja2q2dir2EZ+4le5341cqbZe7/JrVI9fZaeygUS09mqbiv3Sg3/9Wp39MRPMEsHC/YsJCSWnVhvRd5SLPoo3AI4LOlcNQCy8goH5YnmW/p02A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.235) 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=Eu+nGm2R1Rw980cLUiROtpKsrrUD8sKB3+Ltxmyk4ds=; b=J89vP7pEMIDyLkTnFAYvmgbGGGed5/Z8unq+JYwZ0JB65rrkRMk99O7Pjn5LCvU0rlB1LuM8lrJZDMcBI7rRmuMd33lvxm/87CJOCqnvI/5nr3iUlK83G4/04sBJ5o0yuSHJd/N45ggoJbXN9JZ8gWjH0P7wfJu0HJ56NFyA64a7EZ1BAjAed7DUs8Q1+NOpDWau2chARJlCpds7QFWGseORd/4cSYZjk8luznH01QmWWkRD/b7B64m4+hVl4dYGImyDEDDsYVyOV/TLpxHeGNlbAn18AFGAsR0LgaPDYefHxjQzrWW0wk87SiWaEba/Tus0nCf/c+erF7JT5Q8/1Q== Received: from MW4PR04CA0296.namprd04.prod.outlook.com (2603:10b6:303:89::31) by MN0PR12MB6176.namprd12.prod.outlook.com (2603:10b6:208:3c3::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5458.25; Thu, 28 Jul 2022 19:12:19 +0000 Received: from CO1NAM11FT068.eop-nam11.prod.protection.outlook.com (2603:10b6:303:89:cafe::7e) by MW4PR04CA0296.outlook.office365.com (2603:10b6:303:89::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5458.24 via Frontend Transport; Thu, 28 Jul 2022 19:12:19 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.235) 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.235 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.235; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (12.22.5.235) by CO1NAM11FT068.mail.protection.outlook.com (10.13.175.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5482.10 via Frontend Transport; Thu, 28 Jul 2022 19:12:19 +0000 Received: from rnnvmail205.nvidia.com (10.129.68.10) by DRHQMAIL107.nvidia.com (10.27.9.16) with Microsoft SMTP Server (TLS) id 15.0.1497.32; Thu, 28 Jul 2022 19:12:18 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by rnnvmail205.nvidia.com (10.129.68.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.26; Thu, 28 Jul 2022 12:12:17 -0700 Received: from vdi.nvidia.com (10.127.8.14) by mail.nvidia.com (10.129.68.8) with Microsoft SMTP Server id 15.2.986.26 via Frontend Transport; Thu, 28 Jul 2022 12:12:14 -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 V4 1/3] sched/topology: Add NUMA-based CPUs spread API Date: Thu, 28 Jul 2022 22:12:01 +0300 Message-ID: <20220728191203.4055-2-tariqt@nvidia.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20220728191203.4055-1-tariqt@nvidia.com> References: <20220728191203.4055-1-tariqt@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6a2db83c-5065-4027-ab34-08da70cd1794 X-MS-TrafficTypeDiagnostic: MN0PR12MB6176:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WaVADmXJW1eLOiNDj6E2TE/pIZ3PxX+GSrP4KSOAlwEjlOhGeHJITCdQHgv6yTTjjWF7RdueH+BoLStn64yccdWr72YaNSrRmKkVe/C+9EN0KVCaUVoRKdy/oK+LFV5D4dkM6O1blXBBfE+MlqwWMPIbgZyuK3IQ69BismlJl6H0BmOCNHCfL5u92mduSgiqmH/OcE0YnVdCfZsoqOFgTNz61GuMYABrK8KuB1//9lZKO/Sd5Xpj42IqViiuxUJd26ZOSPNx4trhS/Rv0tHGWK7k/aEsdqxBs+wLots2YhhWuGKPEhz8g+0yuzgY599wadF6zM7i1j742O10azDppwycjWMImf4f9Yc4KAsvHSbk2NkaHOx1zMBRESC6YKUXvbqwQoy04AefVnUOq6JVNHI5RtZgq29Ivi0HxmHMB9Lhh8bltDumnxYdxjOwRizKnhX/AQhuHuV+Hir4zvugM/579GCDVOEa6Az87heMT6dWlHgqpZo+CjxHCeugPDzzTGcu0RV+obWYnX9YaPGXaCe5dbyQw/1D8+uwEJ1YHXRnL4ASZssPjdVHoNUHaGkdjgVI3PJynE8C7Mk23d+KNntptgPCV2n/wlKWG4ll2HTV6uOGKUBFSfZ0VvgGrWUbCvZXPpGBk+qdodsi5d3y95InC4ptcLlAQ9A2MxP7t1YLoptvpJrxXaFGfgkH60yZi+Z++vG1YGRPenDSYxH3IMbK/b2XuWfUqbHzfDVSt5G/Eslex23o0hvnZXin7DhfyauQxhL+B0wF/UIvX+z6xzTTvbrf9mP84FhE0gFVFBLDcPna6Jp+0WsDbb4bwCaYbn9mpIFiS/WNCoDGNHQNoA== X-Forefront-Antispam-Report: CIP:12.22.5.235;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:InfoNoRecords;CAT:NONE;SFS:(13230016)(4636009)(136003)(396003)(346002)(376002)(39860400002)(46966006)(40470700004)(36840700001)(82740400003)(47076005)(26005)(70206006)(356005)(81166007)(82310400005)(41300700001)(8676002)(6666004)(316002)(2906002)(70586007)(1076003)(83380400001)(7416002)(40460700003)(2616005)(7696005)(4326008)(478600001)(86362001)(36860700001)(336012)(8936002)(5660300002)(107886003)(40480700001)(426003)(54906003)(110136005)(36756003)(186003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jul 2022 19:12:19.1478 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6a2db83c-5065-4027-ab34-08da70cd1794 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.235];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT068.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB6176 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 | 5 ++++ kernel/sched/topology.c | 49 ++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) diff --git a/include/linux/sched/topology.h b/include/linux/sched/topology.h index 56cffe42abbc..a49167c2a0e5 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,10 @@ 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) +{ + memset(cpus, 0, ncpus * sizeof(*cpus)); +} #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 Thu Jul 28 19:12:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tariq Toukan X-Patchwork-Id: 12931696 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 755FBC04A68 for ; Thu, 28 Jul 2022 19:13:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231736AbiG1TNn (ORCPT ); Thu, 28 Jul 2022 15:13:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233131AbiG1TMb (ORCPT ); Thu, 28 Jul 2022 15:12:31 -0400 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2046.outbound.protection.outlook.com [40.107.94.46]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 158C6691C0; Thu, 28 Jul 2022 12:12:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ht4PB/hXL6doPPJ1CJAl+vR4EKhCyeMIYVb/g4cms61K+bJV4nja/YJ5sv/ZI9/j2uP6Ic1JT5PpmqsmBGCTAVZ/WINC6C0dFynkECdh30cQwwSw0g/CemPpmaR+OZy/LGW0L7RooJ5S+bpuSnf3tuIx0JiZVA5mCRYUSQDH9lAhRryvSr5MMKWn63MVyJ+f3a0HsjIkRHfYOgpBibGvDnOTTNuh+YZAXFwWrGLe5iqTvu5AtQAPD7tnMl3WijcP1lx0uDMdqFX2FkNL6MEzm+5oYivQFDIembvAr5zqEg4bO9PwPgjrnR5FYj7YxGCopAS+rYoWigFkfMNz8ZBpWA== 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=YKplle7nn44U0IqQYHP0CKYRXwr9kQEvyeK+VEwJ0juBWCDZ7uh9+Sh8QADjuQVn1o9tHinM3kOXLjXo1309bjz+pCiPeSVi9Hh/cSxPfIpCqfgBN9lD4w9YQHfGuCyplSypaf128tcJsW2ZQNH+/AKu8SpiHYp8ntbTdF2DOM+l0Jx07p25IQgPDDt7b+6pr+xIoOXZ1gaV64joeRqYrf3W7xg+fHaFTFvAFiYvB9mm6pBuQzTP9gYTxIlNGI7bC0NB92kjq4kCzsSGHkkieQ/ySkMr1j9ZY4dt3xU/SvYwGxdZhE/gldrtAn8nttuz/LepNe8rRKCsHvW/y0KRNQ== 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=C2lMf9nYtTC7ObFBkX9tQCn58+VMFhxBLZpZKx5es9A=; b=Xgt6jRvea2wkMIYdPQYpMeZDfgT2C6heTiRkWTpN2p78dsUjU5BZYyLTX6+qIqCYKupnrs8vCemBJ5tto5tYZ0eVXGD0kswZ+WNC98aQS9hhe6CR4K91BxIl1DB89zFJQiwBRNlRZ/fuzYYxJ/iL32DlMP+NSMfXF/Oh/rvcCGfErlAq8rRrZj7yPVB/8ReSgeSyMcX9L63EsR0wyZkzvsqG6oaJ18TruJbANY80/4QjWVOdBUNd/yxYhKRo05hEzuMPbT1jbqMvHn+l17Fk7pOqLZA8q0itnrC1u+FR8OTc2Mfqeo/Mc38EiT13QpFpfD9UgHNPiFDMUvJzLrBBbw== Received: from MW2PR2101CA0030.namprd21.prod.outlook.com (2603:10b6:302:1::43) by BL1PR12MB5875.namprd12.prod.outlook.com (2603:10b6:208:397::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5458.25; Thu, 28 Jul 2022 19:12:25 +0000 Received: from CO1NAM11FT050.eop-nam11.prod.protection.outlook.com (2603:10b6:302:1:cafe::36) by MW2PR2101CA0030.outlook.office365.com (2603:10b6:302:1::43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.6 via Frontend Transport; Thu, 28 Jul 2022 19:12:25 +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 CO1NAM11FT050.mail.protection.outlook.com (10.13.174.79) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5482.10 via Frontend Transport; Thu, 28 Jul 2022 19:12:24 +0000 Received: from rnnvmail205.nvidia.com (10.129.68.10) by DRHQMAIL105.nvidia.com (10.27.9.14) with Microsoft SMTP Server (TLS) id 15.0.1497.32; Thu, 28 Jul 2022 19:12:22 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by rnnvmail205.nvidia.com (10.129.68.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.26; Thu, 28 Jul 2022 12:12:21 -0700 Received: from vdi.nvidia.com (10.127.8.14) by mail.nvidia.com (10.129.68.8) with Microsoft SMTP Server id 15.2.986.26 via Frontend Transport; Thu, 28 Jul 2022 12:12:18 -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 V4 2/3] net/mlx5e: Improve remote NUMA preferences used for the IRQ affinity hints Date: Thu, 28 Jul 2022 22:12:02 +0300 Message-ID: <20220728191203.4055-3-tariqt@nvidia.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20220728191203.4055-1-tariqt@nvidia.com> References: <20220728191203.4055-1-tariqt@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a270482f-e055-46dc-0f4d-08da70cd1b0e X-MS-TrafficTypeDiagnostic: BL1PR12MB5875:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3JF30MYO0vVhiGHRd6Eg0ZnVNG/pzPY3ExA/HbS9qJWUvkSuP1hF9SQQEaYZFOg4ME7U4pisiXBBctH6JHUd7Hk6Qs/6deJBz0AifGkXyGzoCRZInZiQ1BXKMiDuhUEz7/8xEnOSZ2+8Ae3m7fjqS4v7ixT1wIqAdpJmJb0qbDE7LRXY9pYSyI2kJi+YaiPWrUcx8B91cBdZcr5bzCNpBp1t7qWCCE60NA4JigMI5a1T02EXUEuWuYlfKodRmD83iceL6Qqa9ll0ZNoH8RNY5hjBtocUoSusnmFsuuA141Qkncwz5edfCpbhhoUlDdDX2O4mfOmImmjisp3KVHh0kvod307bJxNX9QTEAK9tREX5XJsHTdu/bGLVTM1vpR/mufPaHx9P4C7LLJK+4f317HRoK23KqMnFGDA1d6lh49BrFAmEwCnwg6ziQT0vjgwL77pyRAh/ScAU7o4dL0ALZ5MVzXZ26OFa8UXF5aajz0O1z4lQpezLxIm22DbGuRgQPt4b12wYwPkga4jyi9FiBBUJlyUhPayor6iGUrF8vX38L9g/DycEIO+W7VsXjAbhP9RKxwGaxxuB464kCe/TJNNx6VLjxsxMCAJT/7X//OtQ3YmOgkb2Vji3D9QnfCdTbpUrmFcOifKXlMfOI9osZAtCs4wiJe6yxM11vPIUILI+J+UfiLUV1sA58hsDL/4HxXW1LtWMxRL9NEfdJIBMEmyujn/bUHFUb38CwYjnqmYCjkTmSNunSsRLRG5vDNyRJrFPdStvRsZz7cP7XVi0BG6CDKnldO6KQfpQaZfmxVtQJNvoqX4vdQlCjLK+8AH1j3uzvBKbCYzkx4sRKd2dew== 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)(136003)(396003)(346002)(376002)(39860400002)(40470700004)(46966006)(36840700001)(7416002)(70206006)(30864003)(186003)(26005)(426003)(5660300002)(336012)(40460700003)(8676002)(356005)(86362001)(82740400003)(82310400005)(54906003)(2906002)(316002)(110136005)(4326008)(36756003)(47076005)(40480700001)(70586007)(81166007)(83380400001)(8936002)(478600001)(41300700001)(7696005)(6666004)(2616005)(1076003)(107886003)(36860700001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jul 2022 19:12:24.9609 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a270482f-e055-46dc-0f4d-08da70cd1b0e 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: CO1NAM11FT050.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5875 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 Thu Jul 28 19:12:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tariq Toukan X-Patchwork-Id: 12931695 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 49B96C19F2B for ; Thu, 28 Jul 2022 19:13:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232989AbiG1TNo (ORCPT ); Thu, 28 Jul 2022 15:13:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233093AbiG1TMa (ORCPT ); Thu, 28 Jul 2022 15:12:30 -0400 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2052.outbound.protection.outlook.com [40.107.244.52]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A9256691D9; Thu, 28 Jul 2022 12:12:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VQMx+vnzV740+n741jCMuyAmjmgNeMyYicnMG70cVu1N4dY4T1StWhGvKpCpPHsWkT1zKsZu+xqxJvGzwkt8dzdbQNqoxHi/Gr34VehoLfGA/NyXNVsCusBgKB6oyO1GYt/sFr7frb0UFqLDarKIBUEoVlcFgBW4uwegflRw9Zu0crdwaFmxEWRtvRT2VU9FdJyJY2fedwjcTniqZCP1Tu+Xdt+xwLCHfpOaqlN0SDdMUq6AATiGI8nBnlrpz5YQh9reecovSVJxPyl6UtY5mtgYgTmBqX/8aJxHG5cLb7ySkuvzgkQHleoi+Q9qR1FxDCTT3StzrkSkCy4oflKLAQ== 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=Q/ZSItYddwfNergPPb9Jv0V3UdpD/Y7eq1HZvEzUaa+cJ6CxjhRoIQrPnW9pDV1ZxnEDlR9eYAYGLOjImqqKyN1ynaZji6INaYvMv32fZd39NmZ2DNPjP6qptZoQeSq74miyBeuxsxHIQHdpPAdAq1OoolulfhQwP6sRl03Byf8nEa72kSrnY8sxVjcVGA9CfUcvFBYWZbAp1MoUMpEj3Q8f0Beei0JLhXf7BDPaE99b3wZvYp2CC3O/IuP98hC6jBeCkAEkN7jR1SRd13LnTrsXuJe/3IZPH09KfnXF/OQVP3R6FzlSBNNot6wwJIQ7ntRN/OueeaVPnCHuhlbHfg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.234) 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=fqNXsp2zLNaeyBC71MuRnxaBQnvBtKx5PCeYYKJiEkUum9/JXpekt5GeuLpwTByo0bB/IaXS5V24SwSb2mlHXNXJofWgp2QgeSAZI3zUF9nbsBq+G8/WIuEnnZMhxDMqOu5mo26CaY9pEzXLZU1BYKcERxn4Z8Yd3M32ZaP0dbK32+SjhppL15J8GVWFx3nGTzSeiYBT3vj2YcCLTIk7XAJChZQ8QlVZb+D53vYh4/+9PFCjJHASw+rSwbQkQKMW96dD+3hMDpb47vznEv4aBORbvQHOGTQIaYKqwQPAGimOw+C2OzgHl/QGAT4Fc6q6EMvXWcYogZg+TkpeO60Waw== Received: from MW4PR04CA0188.namprd04.prod.outlook.com (2603:10b6:303:86::13) by BYAPR12MB2936.namprd12.prod.outlook.com (2603:10b6:a03:12f::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5458.19; Thu, 28 Jul 2022 19:12:28 +0000 Received: from CO1NAM11FT039.eop-nam11.prod.protection.outlook.com (2603:10b6:303:86:cafe::a1) by MW4PR04CA0188.outlook.office365.com (2603:10b6:303:86::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5458.19 via Frontend Transport; Thu, 28 Jul 2022 19:12:27 +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 CO1NAM11FT039.mail.protection.outlook.com (10.13.174.110) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5482.10 via Frontend Transport; Thu, 28 Jul 2022 19:12:27 +0000 Received: from rnnvmail204.nvidia.com (10.129.68.6) by DRHQMAIL101.nvidia.com (10.27.9.10) with Microsoft SMTP Server (TLS) id 15.0.1497.32; Thu, 28 Jul 2022 19:12:27 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by rnnvmail204.nvidia.com (10.129.68.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.26; Thu, 28 Jul 2022 12:12:26 -0700 Received: from vdi.nvidia.com (10.127.8.14) by mail.nvidia.com (10.129.68.8) with Microsoft SMTP Server id 15.2.986.26 via Frontend Transport; Thu, 28 Jul 2022 12:12:22 -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 V4 3/3] enic: Use NUMA distances logic when setting affinity hints Date: Thu, 28 Jul 2022 22:12:03 +0300 Message-ID: <20220728191203.4055-4-tariqt@nvidia.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20220728191203.4055-1-tariqt@nvidia.com> References: <20220728191203.4055-1-tariqt@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 02a8e346-f723-4146-b995-08da70cd1cac X-MS-TrafficTypeDiagnostic: BYAPR12MB2936:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mpCrbIfFHpXW1Qu/BDNW1/pHQV5xeJy/5uJFbDqNVNXON8FPmFIvRULxAEE+zhXt2JJPIAztXaEmY5Aixf/hO2GU3TK59bOurMBQjkgKTjlXy9Ks/yyCR9/Q+tF0b4qyqqczi4yZWFo2thhjoSe+yD17cCArbhkWL0UwfMdky2gjaKba8wobPfFERMe6UiLC7VwzopUFlPJMxbFj8WVJSjYwil5vgc0NKdiO5m/ApdJlSsGf5+zxyF9P6naU+siuqp8TjRXG7HJiPf1xjd/ydTOMoyiqWrVn8STkP3LysLKhtjIN9/FrClUsY9yrLos2BURL8ZkyjAiKwXBm4g7HZvx1zO8kxSlzFKwd50nbMeS8F5vVO8bt5zwGycgR68wnBusEmWxtNiMJcBozAJBccKWN/oaySpWOCrFP05I1dYAzo8jE1Vq8TD+g1OuNCQR+PRYHgo5CVt9VieZ0iCewn6yjC1XIUi4IEBapApWpiHO1TRv+Ksrcttc6zN2G1C9gc4IRH5J+PleuS0YIVJKjihRkUrXftW3ZGxw7DyZUOk3/FdPzhwVF8MnIjxvZLNsCuKhohA6c7WAEf1BfOh2F9VwB/AFf62ZjvglruyfGyt45L9z7rGxAPgoRGlYQOp/AZpneI8Cr1KMUVMvcGiHB8IG/0z2pMRcQLoJC54pK/d75pWGq/P7OG7rmxqHGyAmQG6QyF3x2yKC1oioZbOyvst83jds/Pw3d+t3s19+PssqD1w8Mu57w4iqyvJHm7V70qeNGCMgZAB+eOovNefisbOEaVjgrlQL8ZePNy+W8vo6OOIuhJ6G45tQgqEyJbDCFf1frGgh0gsA4XHiKPHEYW0IRKcdiRtJL+EMrW3Oxgkk= 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)(136003)(346002)(396003)(36840700001)(46966006)(40470700004)(478600001)(36860700001)(40460700003)(70206006)(5660300002)(54906003)(82740400003)(8676002)(8936002)(7416002)(4326008)(316002)(36756003)(186003)(110136005)(2616005)(86362001)(70586007)(426003)(82310400005)(7696005)(40480700001)(6666004)(1076003)(2906002)(356005)(41300700001)(47076005)(26005)(81166007)(83380400001)(336012)(518174003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jul 2022 19:12:27.6784 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 02a8e346-f723-4146-b995-08da70cd1cac 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: CO1NAM11FT039.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR12MB2936 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)