From patchwork Fri Mar 11 07:40:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 12777550 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 0AFC2C433EF for ; Fri, 11 Mar 2022 07:40:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347252AbiCKHlw (ORCPT ); Fri, 11 Mar 2022 02:41:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49836 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343932AbiCKHlr (ORCPT ); Fri, 11 Mar 2022 02:41:47 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44A471B756E for ; Thu, 10 Mar 2022 23:40:45 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D3AA161DCB for ; Fri, 11 Mar 2022 07:40:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D31EDC36AE3; Fri, 11 Mar 2022 07:40:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1646984444; bh=eEWNp2AcKPf8e7Qe6okmHSv005/bMPQvxQg6yjvfh7k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mePKgXjlAcqnX+Gkf+p3OEavuE4goSEMNHeB6TXEn8+ScRchO6boU5MQl/TUKgVzd p/BJlkfWiGaAev5ax+KHFGMbx8VkKywvJAIUAW8gUUQLsaNDTtRCv9dVIj3sZiNHdk 2iZE547pD7rmBfmiG8YStSgcRif1PyKWCPaDX6wL7B19W8G/I6NV16+KAfpiyzofBr nXAGVtQG2tb2836Nm4uFkZ+3vDL3gdZntBWtaTL5G4kEwhaHti5MvFhVMkAftv4JRM knn7DKYUanW1CwAW+NPTgX+O1fKfBP3NTSWVV0lQ58v/+9CxO2YbFZ7S14WHEcTB7L TNkYja6WNKSOg== From: Saeed Mahameed To: "David S. Miller" , Jakub Kicinski Cc: netdev@vger.kernel.org, Tariq Toukan , Moshe Shemesh , Saeed Mahameed Subject: [net-next 06/15] net/mlx5: Node-aware allocation for UAR Date: Thu, 10 Mar 2022 23:40:22 -0800 Message-Id: <20220311074031.645168-7-saeed@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220311074031.645168-1-saeed@kernel.org> References: <20220311074031.645168-1-saeed@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Tariq Toukan Prefer the aware allocation, use the device NUMA node. Signed-off-by: Tariq Toukan Reviewed-by: Moshe Shemesh Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/uar.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/uar.c b/drivers/net/ethernet/mellanox/mlx5/core/uar.c index 9c81fb7c2c3c..8455e79bc44a 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/uar.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/uar.c @@ -99,19 +99,21 @@ static struct mlx5_uars_page *alloc_uars_page(struct mlx5_core_dev *mdev, int err = -ENOMEM; phys_addr_t pfn; int bfregs; + int node; int i; bfregs = uars_per_sys_page(mdev) * MLX5_BFREGS_PER_UAR; - up = kzalloc(sizeof(*up), GFP_KERNEL); + node = mdev->priv.numa_node; + up = kzalloc_node(sizeof(*up), GFP_KERNEL, node); if (!up) return ERR_PTR(err); up->mdev = mdev; - up->reg_bitmap = bitmap_zalloc(bfregs, GFP_KERNEL); + up->reg_bitmap = bitmap_zalloc_node(bfregs, GFP_KERNEL, node); if (!up->reg_bitmap) goto error1; - up->fp_bitmap = bitmap_zalloc(bfregs, GFP_KERNEL); + up->fp_bitmap = bitmap_zalloc_node(bfregs, GFP_KERNEL, node); if (!up->fp_bitmap) goto error1;