Re: [PATCH net-next 04/12] mm: Make the page_frag_cache allocator use multipage folios

From: Jakub Kicinski
Date: Fri May 26 2023 - 20:50:13 EST


On Wed, 24 May 2023 16:33:03 +0100 David Howells wrote:
> - offset = nc->offset - fragsz;
> - if (unlikely(offset < 0)) {
> - page = virt_to_page(nc->va);
> -
> - if (page_ref_count(page) != nc->pagecnt_bias)
> + offset = nc->offset;
> + if (unlikely(fragsz > offset)) {
> + /* Reuse the folio if everyone we gave it to has finished with
> + * it.
> + */
> + if (!folio_ref_sub_and_test(folio, nc->pagecnt_bias)) {
> + nc->folio = NULL;
> goto refill;
> + }
> +
> if (unlikely(nc->pfmemalloc)) {
> - page_ref_sub(page, nc->pagecnt_bias - 1);
> - __free_pages(page, compound_order(page));
> + __folio_put(folio);

This is not a pure 1:1 page -> folio conversion.
Why mix conversion with other code changes?