Commit b5e4c307 authored by Tariq Toukan's avatar Tariq Toukan Committed by Saeed Mahameed
Browse files

net/mlx5: Node-aware allocation for UAR



Prefer the aware allocation, use the device NUMA node.

Signed-off-by: default avatarTariq Toukan <tariqt@nvidia.com>
Reviewed-by: default avatarMoshe Shemesh <moshe@nvidia.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
parent 7f880719
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -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;