Thread (48 messages) 48 messages, 7 authors, 2023-11-30

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

From: Jakub Kicinski <kuba@kernel.org>
Date: 2023-05-27 00:50:11
Also in: linux-arm-kernel, linux-mediatek, linux-mm, linux-nvme, lkml

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?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help