Re: [PATCH 7/7] net: page_pool: use alloc_pages_bulk in refill code path

From: Mel Gorman
Date: Sat Mar 13 2021 - 08:31:58 EST


On Fri, Mar 12, 2021 at 11:44:09AM -0800, Alexander Duyck wrote:
> > - /* FUTURE development:
> > - *
> > - * Current slow-path essentially falls back to single page
> > - * allocations, which doesn't improve performance. This code
> > - * need bulk allocation support from the page allocator code.
> > - */
> > -
> > - /* Cache was empty, do real allocation */
> > -#ifdef CONFIG_NUMA
> > - page = alloc_pages_node(pool->p.nid, gfp, pool->p.order);
> > -#else
> > - page = alloc_pages(gfp, pool->p.order);
> > -#endif
> > - if (!page)
> > + if (unlikely(!__alloc_pages_bulk(gfp, pp_nid, NULL, bulk, &page_list)))
> > return NULL;
> >
> > + /* First page is extracted and returned to caller */
> > + first_page = list_first_entry(&page_list, struct page, lru);
> > + list_del(&first_page->lru);
> > +
>
> This seems kind of broken to me. If you pull the first page and then
> cannot map it you end up returning NULL even if you placed a number of
> pages in the cache.
>

I think you're right but I'm punting this to Jesper to fix. He's more
familiar with this particular code and can verify the performance is
still ok for high speed networks.

--
Mel Gorman
SUSE Labs