Re: [PATCH 1/5] RDMA/umem: ib_umem_get(): use kmalloc() to allocate page array

From: Jason Gunthorpe

Date: Tue Jun 30 2026 - 08:32:07 EST


On Tue, Jun 30, 2026 at 01:52:29PM +0300, Mike Rapoport (Microsoft) wrote:
> ib_umem_get() allocates an array of pointers to struct page for
> pin_user_pages_fast() calls during memory registration.

A whole bunch of these use cases in rdma are really "give me some
temporary memory, I want it fast and as large as possible. In a
syscall context I will free it before returning back to userspace"

eg we'd be really happy to get any kind of high order page here.

So, how would you feel about a new API?

void *kmalloc_temporary(size_t min_size, size_t max_size, size_t *actual_size, gfp);

I know of a few other cases like this in the kernel at least.

The implementation could try to find an available high order page and
immediately return it, otherwise do a small reclaim allocation?

Jason