* [PATCH for-rc] RDMA/rxe: Allocate the MR page array with kvzalloc()
@ 2026-11-23 9:26 Qiliang Yuan
2026-11-23 9:33 ` sashiko-bot
0 siblings, 1 reply; 2+ messages in thread
From: Qiliang Yuan @ 2026-11-23 9:26 UTC (permalink / raw)
To: Zhu Yanjun, Jason Gunthorpe, Leon Romanovsky, Li Zhijian
Cc: linux-rdma, linux-kernel, Zhu Yanjun, stable, Qiliang Yuan
A user MR keeps a struct rxe_mr_page, 16 bytes on 64-bit, for every
PAGE_SIZE page it covers, in one array allocated with kzalloc() when the
MR is registered. Before the array, the pages were kept in an xarray.
With 4 KiB pages, the array of an MR larger than 1 GiB exceeds
KMALLOC_MAX_SIZE, so registering it fails with -ENOMEM, and the first
attempt warns:
WARNING: mm/slub.c:5459 at ___kmalloc_large_node+0xe9/0x130
Call Trace:
__kmalloc_large_node_noprof
__kmalloc_noprof
__alloc_mr_page_info
rxe_mr_init_user
rxe_reg_user_mr
Allocate the array with kvzalloc_objs() and free it with kvfree(), so
that MRs of any size can be registered again.
Registering an MR over THP-backed memory, median of 3:
size before (ms) after (ms) change
1 GiB 5.3 5.2 -2%
2 GiB -ENOMEM 10.8 n/a
4 GiB -ENOMEM 21.1 n/a
16 GiB -ENOMEM 85.9 n/a
Fixes: 12985e5915a0b ("RDMA/rxe: Fix iova-to-va conversion for MR page sizes != PAGE_SIZE")
Cc: stable@vger.kernel.org
Signed-off-by: Qiliang Yuan <qiliang.yuan@linux.dev>
---
drivers/infiniband/sw/rxe/rxe_mr.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/infiniband/sw/rxe/rxe_mr.c b/drivers/infiniband/sw/rxe/rxe_mr.c
index 13cb28d3916f6..fbf4d89947383 100644
--- a/drivers/infiniband/sw/rxe/rxe_mr.c
+++ b/drivers/infiniband/sw/rxe/rxe_mr.c
@@ -157,7 +157,7 @@ static int rxe_mr_fill_pages_from_sgt(struct rxe_mr *mr, struct sg_table *sgt)
static int __alloc_mr_page_info(struct rxe_mr *mr, int num_pages)
{
- mr->page_info = kzalloc_objs(struct rxe_mr_page, num_pages);
+ mr->page_info = kvzalloc_objs(struct rxe_mr_page, num_pages);
if (!mr->page_info)
return -ENOMEM;
@@ -186,7 +186,7 @@ static void free_mr_page_info(struct rxe_mr *mr)
if (!mr->page_info)
return;
- kfree(mr->page_info);
+ kvfree(mr->page_info);
mr->page_info = NULL;
}
---
base-commit: e7732ec135b501e87ab060d992b3b5f2ec4396c9
change-id: 20261123-bug-rdma-rxe-large-mr-f752a49d8365
Best regards,
--
Qiliang Yuan <qiliang.yuan@linux.dev>
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH for-rc] RDMA/rxe: Allocate the MR page array with kvzalloc()
2026-11-23 9:26 [PATCH for-rc] RDMA/rxe: Allocate the MR page array with kvzalloc() Qiliang Yuan
@ 2026-11-23 9:33 ` sashiko-bot
0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-11-23 9:33 UTC (permalink / raw)
To: Qiliang Yuan; +Cc: linux-rdma
> A user MR keeps a struct rxe_mr_page, 16 bytes on 64-bit, for every
> PAGE_SIZE page it covers, in one array allocated with kzalloc() when the
> MR is registered. Before the array, the pages were kept in an xarray.
>
> With 4 KiB pages, the array of an MR larger than 1 GiB exceeds
> KMALLOC_MAX_SIZE, so registering it fails with -ENOMEM, and the first
> attempt warns:
>
> WARNING: mm/slub.c:5459 at ___kmalloc_large_node+0xe9/0x130
> Call Trace:
> __kmalloc_large_node_noprof
> __kmalloc_noprof
> __alloc_mr_page_info
> rxe_mr_init_user
> rxe_reg_user_mr
>
> Allocate the array with kvzalloc_objs() and free it with kvfree(), so
> that MRs of any size can be registered again.
>
> Registering an MR over THP-backed memory, median of 3:
>
> size before (ms) after (ms) change
> 1 GiB 5.3 5.2 -2%
> 2 GiB -ENOMEM 10.8 n/a
> 4 GiB -ENOMEM 21.1 n/a
> 16 GiB -ENOMEM 85.9 n/a
>
> Fixes: 12985e5915a0b ("RDMA/rxe: Fix iova-to-va conversion for MR page sizes != PAGE_SIZE")
> Cc: stable@vger.kernel.org
> Signed-off-by: Qiliang Yuan <qiliang.yuan@linux.dev>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261123-bug-rdma-rxe-large-mr-v1-1-8d0748ac4a3f@linux.dev?part=1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-23 9:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-23 9:26 [PATCH for-rc] RDMA/rxe: Allocate the MR page array with kvzalloc() Qiliang Yuan
2026-11-23 9:33 ` sashiko-bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox