From nobody Sat Jul 25 17:34:23 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 22450334692; Wed, 15 Jul 2026 11:03:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784113409; cv=none; b=J4CvIBVsXs3MmvARXGUojpTDJ9xSMVYQvCgW64jIz0ANbnqbl8y70yy/y/F+boYI8Jj93h9S3EpPUIJ2TtMRgWhBT106FgQtkxvfC+IszPHW7NSWScDJOthxSwZShGtUEK8AzR9BkSkLOGzidYEcCpBcKZUhM2omln6XzE14Nno= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784113409; c=relaxed/simple; bh=3OvHQeH8X15G68xAWsxjZwDBnqtvwt+xsNLQl29eLgA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=P44CO+pffDhAkrrgI1sbCrLd9qhXLeP8Vdod+hM2enb2KprNyu021JQq9484k1JqiLRgAOIzvAPH1n11g3qEaudKn+pCNYAcvPSJ5F8eVVdNeQ+JZGniu8sCRgMVSpcRZBxGEVpu5yB9OFtmjOtJw68pGIL90+4eP32SpX2K0uM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=A1v6T3yT; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="A1v6T3yT" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C81771F000E9; Wed, 15 Jul 2026 11:03:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1784113407; bh=+6L2mR1Z7PucopuI1/SHxIqdO9XYAj/qxei07U+TFyA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=A1v6T3yTmihfZid2P83olrspUF/t38FQq4dqOFdECNnR7UxWbc4Eq4dZzqYik9Y7a th5OugAo+4bTeOaZ3+IpYUwx3dKjWxI7J1ku82vJTv+qX+S8dbFcaZfoc0DzDsPh2V jyCmT4wqGQNJ+Y7k90RYtZLMVwdqRxd/WKkXYokYBin55D7/jjcJ1R/dB8HEhBar5a 68jS1RKjjVsTr+7hXi8/m1QoUwj2CvDt9XxPRy2adSqUqjgulYVoD1SK9zgRVr8Mhk w9j0TXkiJK0h6rTjClK7wvwXKRCGmnm2xZIWkQBDaK70bQRsLng/p/34U1vtm/2lTQ Ay2KpuB1Ywayw== From: Leon Romanovsky To: Potnuri Bharat Teja , Jason Gunthorpe , Yishai Hadas , Nelson Escobar , Satish Kharat Cc: linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, Mike Rapoport Subject: [PATCH rdma-next 1/4] RDMA/cxgb4: use kmalloc() for the PBL address array Date: Wed, 15 Jul 2026 14:03:09 +0300 Message-ID: <20260715-get_pages-to-kmalloc-v1-1-b0b7fce288be@nvidia.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260715-get_pages-to-kmalloc-v1-0-b0b7fce288be@nvidia.com> References: <20260715-get_pages-to-kmalloc-v1-0-b0b7fce288be@nvidia.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" X-Mailer: b4 0.15-dev-18f8f Content-Transfer-Encoding: quoted-printable From: Leon Romanovsky c4iw_reg_user_mr() allocates a page-sized temporary array of DMA addresses while programming a PBL. The array has no page-specific requirements, so allocate it with kmalloc() and release it with kfree(). This avoids the casts required by the page allocator and lets the free operation derive the allocation size from the object. Signed-off-by: Leon Romanovsky Acked-by: Mike Rapoport (Microsoft) --- drivers/infiniband/hw/cxgb4/mem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/hw/cxgb4/mem.c b/drivers/infiniband/hw/cxgb= 4/mem.c index cd1b01014198..49498c75f38f 100644 --- a/drivers/infiniband/hw/cxgb4/mem.c +++ b/drivers/infiniband/hw/cxgb4/mem.c @@ -541,7 +541,7 @@ struct ib_mr *c4iw_reg_user_mr(struct ib_pd *pd, u64 st= art, u64 length, if (err) goto err_umem_release; =20 - pages =3D (__be64 *) __get_free_page(GFP_KERNEL); + pages =3D kmalloc(PAGE_SIZE, GFP_KERNEL); if (!pages) { err =3D -ENOMEM; goto err_pbl_free; @@ -568,7 +568,7 @@ struct ib_mr *c4iw_reg_user_mr(struct ib_pd *pd, u64 st= art, u64 length, mhp->wr_waitp); =20 pbl_done: - free_page((unsigned long) pages); + kfree(pages); if (err) goto err_pbl_free; =20 --=20 2.55.0 From nobody Sat Jul 25 17:34:23 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 63F712931D7; Wed, 15 Jul 2026 11:03:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784113414; cv=none; b=NyW9PlSvMwjrtnxWIASWp10jy7r66KCbxHagRzUbptUq06K8Fmlk1LCIHKVHa74IrvEUyJMQLMTc9EhpaRkqBiYM5LdFAjEje8ShgHyKWSWdmA/s3ziiGpLkygVJ+QuakvLaW1JvyYwn8a1b+cmShVmwdWaH6LIc0gbyUDTnpk4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784113414; c=relaxed/simple; bh=YVfNgKLJqLMc3cgYjhzOYCdFXrpn8ajwevb61bQVXV8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=OlbcZwYlAjbqzPrB7lHbWzUWPsCu55MotXXQjud82a7bgLc1CJ4JY63Gwbhrj2EHeuH8sNIizcxzyS5wQQofGR0VdRs08P/jk9SB2xq9240Yh+oY76dhzq9wzGfCyYgL2Q3M4eKmQZk4DOTDOjZrP/JODNgCsvfxnuCQTqGhp0g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=FqO6427z; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="FqO6427z" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1A87E1F000E9; Wed, 15 Jul 2026 11:03:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1784113413; bh=oQkZyUXmELQN2zMIAqet4gZF6hrG+qrP9SS1Y/vJinM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=FqO6427zEcFyWwsUFlMdV3S0o5lVjm9vAF3xG7TLvhLLWDFNUNSq6w2EBONEpXOLf cVGlXcbkwQRcqv+zduLbKKWuNayczM0a3JWCydjyAKsEU9ZKq4ZACGXLKr86BTLbyZ tRWVDWbDfGIBoHQ85Mt48InzRsPJ/W7+jJGx7QSr3KMicxWg15fLsSbF+ITleEwmk4 9bfdDewy9LzQ1pRD47f3/iwy29ygICVDosMmGAKlvFgwOeEtU8+75tAfa1UiFEp0yj GDPOyrwgJ0NGUnPPhFe3T+nQewzgmBqAlGxKmgoSwmq880hPbjQ1HQY56ykFeVbrPs 8yjRjn8MEdHWQ== From: Leon Romanovsky To: Potnuri Bharat Teja , Jason Gunthorpe , Yishai Hadas , Nelson Escobar , Satish Kharat Cc: linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, Mike Rapoport Subject: [PATCH rdma-next 2/4] RDMA/mlx4: use kzalloc() for the fast registration page list Date: Wed, 15 Jul 2026 14:03:10 +0300 Message-ID: <20260715-get_pages-to-kmalloc-v1-2-b0b7fce288be@nvidia.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260715-get_pages-to-kmalloc-v1-0-b0b7fce288be@nvidia.com> References: <20260715-get_pages-to-kmalloc-v1-0-b0b7fce288be@nvidia.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" X-Mailer: b4 0.15-dev-18f8f Content-Transfer-Encoding: quoted-printable From: Leon Romanovsky mlx4_alloc_priv_pages() allocates a zeroed, page-sized buffer for a DMA-to-device page list. kmalloc() provides the required physical contiguity, and a PAGE_SIZE allocation retains the alignment needed to keep the list within one page. Use kzalloc() for the buffer and kfree() on the error and teardown paths. Signed-off-by: Leon Romanovsky Acked-by: Mike Rapoport (Microsoft) --- drivers/infiniband/hw/mlx4/mr.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/infiniband/hw/mlx4/mr.c b/drivers/infiniband/hw/mlx4/m= r.c index 761e2c05dd0f..a6b4abce1bfe 100644 --- a/drivers/infiniband/hw/mlx4/mr.c +++ b/drivers/infiniband/hw/mlx4/mr.c @@ -313,7 +313,7 @@ mlx4_alloc_priv_pages(struct ib_device *device, MLX4_MR_PAGES_ALIGN); =20 /* Prevent cross page boundary allocation. */ - mr->pages =3D (__be64 *)get_zeroed_page(GFP_KERNEL); + mr->pages =3D kzalloc(PAGE_SIZE, GFP_KERNEL); if (!mr->pages) return -ENOMEM; =20 @@ -328,7 +328,7 @@ mlx4_alloc_priv_pages(struct ib_device *device, return 0; =20 err: - free_page((unsigned long)mr->pages); + kfree(mr->pages); return ret; } =20 @@ -340,7 +340,7 @@ mlx4_free_priv_pages(struct mlx4_ib_mr *mr) =20 dma_unmap_single(device->dev.parent, mr->page_map, mr->page_map_size, DMA_TO_DEVICE); - free_page((unsigned long)mr->pages); + kfree(mr->pages); mr->pages =3D NULL; } } --=20 2.55.0 From nobody Sat Jul 25 17:34:23 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0C03141D63E; Wed, 15 Jul 2026 11:03:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784113431; cv=none; b=Ay5J+zom6i+wgIh7VR+OfqvdJhlrQgpL1zOtiHn08f08V+jl55RUZ9BhQS/YIOV1lH840eeAuUpv1PAoMF85HvDbcxJd4nP+pSziReOmAgOhievQ5YqAnIuAAborihjz7x5ogMpfaoCxtyjTzjRyYAGLws4gxJy1uM6MVdkChAo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784113431; c=relaxed/simple; bh=tHqJEhY8nKEHbH40oSO2VwHqpVReYeEZYB4VJKU4WCA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=L1nT9BNg1HB0LHWZmC3sBzyfmBq44LJRv/qk2Q7Q+DE4/t6ESp6gwTY1MmEGQ/1YKaMo9wjMmLxkGm7Fc5npCaVzrsTIzTH/lnnqtFPA2URpKmK1LN/07vEEA7A9uLnDVS1C37ERpm3Ylhub9ciVGsg1dxrLTsA92ZwKQWpiOJM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=hyILeJOd; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="hyILeJOd" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D27491F0155F; Wed, 15 Jul 2026 11:03:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1784113423; bh=avljnXKrp0xXdt8T2yC/othJrQltLuKsk1y5OVGjVfc=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=hyILeJOdi0ogtH7mULO81b+ru9V41C4HPsXQhjrNJ9QuDUdyVWVRMlVDwj4RSGpER lVWV443A8scgVqo2d5L2jGTwmvbeG/Bum7mX/c9Wc7/EZBGP6/hOr6CJDjTSmJzz8t hvYoV8KnZq4KfSF9wbM0JNuh6HflGrGWoxhXZIIo9q2gKCPdgcP7H1S/xgJImWdxXG oFNICx6Kr6jS24qupwammUdbuYxdL2ap3MqEIGBH4y/POL2JNsjiTQXs/VsAulQuTX J2VdcvzvRuZD3woSkk0rEkE0gGcwSy4/Dg5vrbhwk++xf+HoqYkR7FMk7X9FB4e0ep WunzM+2PGOtxQ== From: Leon Romanovsky To: Potnuri Bharat Teja , Jason Gunthorpe , Yishai Hadas , Nelson Escobar , Satish Kharat Cc: linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, Mike Rapoport Subject: [PATCH rdma-next 3/4] RDMA/usnic: use kmalloc() for the page pointer array Date: Wed, 15 Jul 2026 14:03:11 +0300 Message-ID: <20260715-get_pages-to-kmalloc-v1-3-b0b7fce288be@nvidia.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260715-get_pages-to-kmalloc-v1-0-b0b7fce288be@nvidia.com> References: <20260715-get_pages-to-kmalloc-v1-0-b0b7fce288be@nvidia.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" X-Mailer: b4 0.15-dev-18f8f Content-Transfer-Encoding: quoted-printable From: Leon Romanovsky usnic_uiom_get_pages() uses a page-sized array of struct page pointers as temporary storage for pin_user_pages(). Nothing requires the array to come directly from the page allocator. Use kmalloc() for the array and kfree() after the pinning loop. Signed-off-by: Leon Romanovsky Acked-by: Mike Rapoport (Microsoft) --- drivers/infiniband/hw/usnic/usnic_uiom.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/hw/usnic/usnic_uiom.c b/drivers/infiniband/= hw/usnic/usnic_uiom.c index 691c64a73516..201c35039a74 100644 --- a/drivers/infiniband/hw/usnic/usnic_uiom.c +++ b/drivers/infiniband/hw/usnic/usnic_uiom.c @@ -114,7 +114,7 @@ static int usnic_uiom_get_pages(unsigned long addr, siz= e_t size, int writable, =20 INIT_LIST_HEAD(chunk_list); =20 - page_list =3D (struct page **) __get_free_page(GFP_KERNEL); + page_list =3D kmalloc(PAGE_SIZE, GFP_KERNEL); if (!page_list) return -ENOMEM; =20 @@ -182,7 +182,7 @@ static int usnic_uiom_get_pages(unsigned long addr, siz= e_t size, int writable, mmgrab(uiomr->owning_mm); =20 mmap_read_unlock(mm); - free_page((unsigned long) page_list); + kfree(page_list); return ret; } =20 --=20 2.55.0 From nobody Sat Jul 25 17:34:23 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C29A5334692; Wed, 15 Jul 2026 11:03:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784113419; cv=none; b=geiUYtZm6ZyK950YVrUcZ+x7BfSFuIYUSIa9VjHMDKID0ERGCtgHLNCIaOGcUu8d5/ivdV+Qq4PY/SoTT6gke58kSSkFDTJO+QuSNJVswyKYIzvvVdO6bthCeRBBtIjsQ0nOp7+6kC9N4DbzVOODsROt42i1IMoVWHZwCsuA6j4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784113419; c=relaxed/simple; bh=mIpyjSxJCIDvrqI9R1Kq81l9GrFi0L+7TF/IXvrEpXo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=KaYAUlT340fYy8cm6WJ9CJrSSn5yHnaibz0Cef+a9ZCWn1Ziv9yvSPIOMsN1cIWTjimNnycbzjnjQT4VYJzx5VV0c5M3jHBODUZrwzlwcudf8ehCHUiLiQskdmS8SoniDz5dQPIUZltYBNn/+b3n96r2P5tAV4HeYh/S3ZZcqP0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=FijBLDHi; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="FijBLDHi" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 858861F000E9; Wed, 15 Jul 2026 11:03:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1784113418; bh=CA2d2kU1oTVwSL1+B4sDmaQjh3T/3PPYj8qWh2dEGxw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=FijBLDHi3oiIEPNxkrWpk2SFIneNFQXitLXJSUuRh3KY/FNwz8cE3nz8Zb5PJiyso Obz2fSg0VUTkK6VdNIJc0QSGIMyzK5hZuTeINTo1Udt62izMmgxnfkyCi30suVWi3+ 33FX82L9TF4wubAmzEHQtz5BA5hRFkZG+PuJmzN7OBwihR3kNNhpKzfaEhuqRdWk8w h9zSTacVogivN80NGtTUsf/l73UBnxkVESv97hxVvXTmdAxx6wMDxlkGUSzLMaK+Ba y4mh5J/tla5zKFRmcMU6Vj+AXsEsgpg6+lZ54K78aaduP1GNPZi6OFfdVYWZknyFQj BvCU8rk61aCMw== From: Leon Romanovsky To: Potnuri Bharat Teja , Jason Gunthorpe , Yishai Hadas , Nelson Escobar , Satish Kharat Cc: linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, Mike Rapoport Subject: [PATCH rdma-next 4/4] RDMA/mlx5: use kmalloc() for UMR translation buffers Date: Wed, 15 Jul 2026 14:03:12 +0300 Message-ID: <20260715-get_pages-to-kmalloc-v1-4-b0b7fce288be@nvidia.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260715-get_pages-to-kmalloc-v1-0-b0b7fce288be@nvidia.com> References: <20260715-get_pages-to-kmalloc-v1-0-b0b7fce288be@nvidia.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" X-Mailer: b4 0.15-dev-18f8f Content-Transfer-Encoding: quoted-printable From: Leon Romanovsky mlx5r_umr_alloc_xlt() allocates physically contiguous scratch buffers that are DMA mapped only in the DMA_TO_DEVICE direction. kmalloc() provides the required contiguity and alignment for these sizes while preserving the existing GFP allocation policy. The emergency translation buffer has the same requirements. Convert all of these UMR buffers to kmalloc() and release them with kfree(), which no longer requires the caller to supply the allocation order. Signed-off-by: Leon Romanovsky Acked-by: Mike Rapoport (Microsoft) --- drivers/infiniband/hw/mlx5/main.c | 8 ++++---- drivers/infiniband/hw/mlx5/umr.c | 11 +++++------ 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5= /main.c index e8bba5a76d4e..d65ebdef2823 100644 --- a/drivers/infiniband/hw/mlx5/main.c +++ b/drivers/infiniband/hw/mlx5/main.c @@ -5500,13 +5500,13 @@ static int __init mlx5_ib_init(void) { int ret; =20 - xlt_emergency_page =3D (void *)__get_free_page(GFP_KERNEL); + xlt_emergency_page =3D kmalloc(PAGE_SIZE, GFP_KERNEL); if (!xlt_emergency_page) return -ENOMEM; =20 mlx5_ib_event_wq =3D alloc_ordered_workqueue("mlx5_ib_event_wq", 0); if (!mlx5_ib_event_wq) { - free_page((unsigned long)xlt_emergency_page); + kfree(xlt_emergency_page); return -ENOMEM; } =20 @@ -5540,7 +5540,7 @@ static int __init mlx5_ib_init(void) mlx5_ib_qp_event_cleanup(); qp_event_err: destroy_workqueue(mlx5_ib_event_wq); - free_page((unsigned long)xlt_emergency_page); + kfree(xlt_emergency_page); return ret; } =20 @@ -5553,7 +5553,7 @@ static void __exit mlx5_ib_cleanup(void) =20 mlx5_ib_qp_event_cleanup(); destroy_workqueue(mlx5_ib_event_wq); - free_page((unsigned long)xlt_emergency_page); + kfree(xlt_emergency_page); } =20 module_init(mlx5_ib_init); diff --git a/drivers/infiniband/hw/mlx5/umr.c b/drivers/infiniband/hw/mlx5/= umr.c index c595b85b428c..80d0d190b26c 100644 --- a/drivers/infiniband/hw/mlx5/umr.c +++ b/drivers/infiniband/hw/mlx5/umr.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB /* Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. */ =20 +#include #include #include #include "mlx5_ib.h" @@ -517,22 +518,20 @@ static void *mlx5r_umr_alloc_xlt(size_t *nents, size_= t ent_size, gfp_t gfp_mask) size =3D min_t(size_t, ent_size * ALIGN(*nents, xlt_chunk_align), MLX5_MAX_UMR_CHUNK); *nents =3D size / ent_size; - res =3D (void *)__get_free_pages(gfp_mask | __GFP_NOWARN, - get_order(size)); + res =3D kmalloc(size, gfp_mask | __GFP_NOWARN); if (res) return res; =20 if (size > MLX5_SPARE_UMR_CHUNK) { size =3D MLX5_SPARE_UMR_CHUNK; *nents =3D size / ent_size; - res =3D (void *)__get_free_pages(gfp_mask | __GFP_NOWARN, - get_order(size)); + res =3D kmalloc(size, gfp_mask | __GFP_NOWARN); if (res) return res; } =20 *nents =3D PAGE_SIZE / ent_size; - res =3D (void *)__get_free_page(gfp_mask); + res =3D kmalloc(PAGE_SIZE, gfp_mask); if (res) return res; =20 @@ -548,7 +547,7 @@ static void mlx5r_umr_free_xlt(void *xlt, size_t length) return; } =20 - free_pages((unsigned long)xlt, get_order(length)); + kfree(xlt); } =20 static void mlx5r_umr_unmap_free_xlt(struct mlx5_ib_dev *dev, void *xlt, --=20 2.55.0