RDMA/usnic: use kmalloc() for the page pointer array

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.

Link: https://patch.msgid.link/20260715-get_pages-to-kmalloc-v1-3-b0b7fce288be@nvidia.com
Acked-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
This commit is contained in:
Leon Romanovsky 2026-07-16 05:03:31 -04:00 committed by Leon Romanovsky
parent ce5322367c
commit ed3760b376

View File

@ -114,7 +114,7 @@ static int usnic_uiom_get_pages(unsigned long addr, size_t size, int writable,
INIT_LIST_HEAD(chunk_list);
page_list = (struct page **) __get_free_page(GFP_KERNEL);
page_list = kmalloc(PAGE_SIZE, GFP_KERNEL);
if (!page_list)
return -ENOMEM;
@ -182,7 +182,7 @@ static int usnic_uiom_get_pages(unsigned long addr, size_t size, int writable,
mmgrab(uiomr->owning_mm);
mmap_read_unlock(mm);
free_page((unsigned long) page_list);
kfree(page_list);
return ret;
}