revisiting alloc_pages_bulks semantics?

From: Christoph Hellwig

Date: Wed May 27 2026 - 03:19:07 EST


Hi all,

I've been looking into using alloc_pages_bulks in a few places lately,
and have run into issues with the API. Here is my suggestions for how
to make this more useful, although only some of them are something
I'd feel comfortable to do myself:

1) early fail semantics

alloc_pages_bulks can do partial allocations for some reasons, and
users usually have a fallback by either looping and calling it again
or falling back to single page allocations. This sucks! Why can't
we get our usual try as hard as you can semantics, requiring
GFP_NORETRY or similar to relax it?

2) pre-zeroed page array

There is one single user (svc_fill_pages in sunrpc) that relies on it.
For everyone else it creates extra burden and is very error prone
(speaking from experience).

3) page instead of folio

We're allocating folios, so we should have a folio API.

4) > order 0 support

The bulk allocator is limited to order 0 which limits it's usefulness
these days. It would be really helpful to do bulk allocations for
the pagecache or bounce buffering.