io_uring: stop calling free_compound_page()
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Wed, 16 Aug 2023 15:11:49 +0000 (16:11 +0100)
committerAndrew Morton <akpm@linux-foundation.org>
Mon, 21 Aug 2023 21:28:42 +0000 (14:28 -0700)
Patch series "Remove _folio_dtor and _folio_order", v2.

This patch (of 13):

folio_put() is the standard way to write this, and it's not appreciably
slower.  This is an enabling patch for removing free_compound_page()
entirely.

Link: https://lkml.kernel.org/r/20230816151201.3655946-1-willy@infradead.org
Link: https://lkml.kernel.org/r/20230816151201.3655946-2-willy@infradead.org
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Jens Axboe <axboe@kernel.dk>
Cc: Sidhartha Kumar <sidhartha.kumar@oracle.com>
Cc: Yanteng Si <siyanteng@loongson.cn>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
io_uring/io_uring.c
io_uring/kbuf.c

index f4591b912ea8e966fd957d998f63811d70806a2b..6adf3b4799144c49bb31fe566584d4a4087124b0 100644 (file)
@@ -2643,14 +2643,10 @@ static int io_cqring_wait(struct io_ring_ctx *ctx, int min_events,
 
 static void io_mem_free(void *ptr)
 {
-       struct page *page;
-
        if (!ptr)
                return;
 
-       page = virt_to_head_page(ptr);
-       if (put_page_testzero(page))
-               free_compound_page(page);
+       folio_put(virt_to_folio(ptr));
 }
 
 static void io_pages_free(struct page ***pages, int npages)
index 2f0181521c98e41d6a0af6dc83d3d5491956f92b..556f4df25b0fa0119ea9a135311256b2fda2573a 100644 (file)
@@ -218,11 +218,7 @@ static int __io_remove_buffers(struct io_ring_ctx *ctx,
        if (bl->is_mapped) {
                i = bl->buf_ring->tail - bl->head;
                if (bl->is_mmap) {
-                       struct page *page;
-
-                       page = virt_to_head_page(bl->buf_ring);
-                       if (put_page_testzero(page))
-                               free_compound_page(page);
+                       folio_put(virt_to_folio(bl->buf_ring));
                        bl->buf_ring = NULL;
                        bl->is_mmap = 0;
                } else if (bl->buf_nr_pages) {