From: Jason Gunthorpe <jgg@ziepe.ca>
To: Mike Rapoport <rppt@kernel.org>
Cc: Vlastimil Babka <vbabka@kernel.org>,
Leon Romanovsky <leon@kernel.org>,
Dennis Dalessandro <dennis.dalessandro@cornelisnetworks.com>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
linux-rdma@vger.kernel.org
Subject: Re: [PATCH 1/5] RDMA/umem: ib_umem_get(): use kmalloc() to allocate page array
Date: Tue, 30 Jun 2026 12:36:38 -0300 [thread overview]
Message-ID: <20260630153638.GG7525@ziepe.ca> (raw)
In-Reply-To: <akPaPaCJdYINBEEV@kernel.org>
On Tue, Jun 30, 2026 at 06:01:17PM +0300, Mike Rapoport wrote:
> (actually adding Vlastimil :) )
>
> On Tue, Jun 30, 2026 at 06:00:24PM +0300, Mike Rapoport wrote:
> > (adding Vlastimil)
> >
> > On Tue, Jun 30, 2026 at 09:31:50AM -0300, Jason Gunthorpe wrote:
> > > 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"
> >
> > Not sure I follow where "as large as possible" comes from. Here it's
> > explicitly a page.
It is a page because that is "fast"
There will be a calculation what the upper limit of memory is that
this algorithm can use.
> > And does "fast" mean that vmalloc() is not an option?
Yes. The trade off is you do fewer iterations of some loop if you have
a bigger temporary buffer. But if it takes longer to allocate than the loop
iterations then it doesn't help.
> > > 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?
> >
> > How do you suggest to decide how much of reclaim should happen?
> > With the usual semantics of gfp?
Yeah, when all options are exhausted you do some allocation with the
usual GFP options.
Jason
next prev parent reply other threads:[~2026-06-30 15:36 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-30 10:52 [PATCH 0/5] RDMA, IB: replace __get_free_pages() with kmalloc() Mike Rapoport (Microsoft)
2026-06-30 10:52 ` [PATCH 1/5] RDMA/umem: ib_umem_get(): use kmalloc() to allocate page array Mike Rapoport (Microsoft)
2026-06-30 12:31 ` Jason Gunthorpe
2026-06-30 15:00 ` Mike Rapoport
2026-06-30 15:01 ` Mike Rapoport
2026-06-30 15:36 ` Jason Gunthorpe [this message]
2026-06-30 10:52 ` [PATCH 2/5] RDMA/mlx5: replace __get_free_page() with kmalloc() Mike Rapoport (Microsoft)
2026-06-30 10:52 ` [PATCH 3/5] IB/mthca: mthca_reg_user_mr(): use kmalloc() to allocate addresses array Mike Rapoport (Microsoft)
2026-06-30 10:52 ` [PATCH 4/5] IB/mthca: allocate mthca_array memory with kzalloc() Mike Rapoport (Microsoft)
2026-06-30 10:52 ` [PATCH 5/5] IB/rdmavt: use kzalloc() to allocate QPN-map pages Mike Rapoport (Microsoft)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260630153638.GG7525@ziepe.ca \
--to=jgg@ziepe.ca \
--cc=dennis.dalessandro@cornelisnetworks.com \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-rdma@vger.kernel.org \
--cc=rppt@kernel.org \
--cc=vbabka@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox