]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
io_uring/rsrc: use GFP_KERNEL_ACCOUNT consistently
authorJens Axboe <axboe@kernel.dk>
Sun, 25 Jan 2026 17:07:35 +0000 (10:07 -0700)
committerJens Axboe <axboe@kernel.dk>
Sun, 25 Jan 2026 17:07:35 +0000 (10:07 -0700)
For potential long term allocations, ensure that we play nicer with
memcg and use the accounting variant of the GFP_KERNEL allocation.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
io_uring/memmap.c
io_uring/rsrc.c

index 18e574776ef65b988756b64ed982b6750f261697..81b527dc96f7ea4daf1ed779b3ed16d7feb09728 100644 (file)
@@ -56,7 +56,7 @@ struct page **io_pin_pages(unsigned long uaddr, unsigned long len, int *npages)
        if (WARN_ON_ONCE(nr_pages > INT_MAX))
                return ERR_PTR(-EOVERFLOW);
 
-       pages = kvmalloc_array(nr_pages, sizeof(struct page *), GFP_KERNEL);
+       pages = kvmalloc_array(nr_pages, sizeof(struct page *), GFP_KERNEL_ACCOUNT);
        if (!pages)
                return ERR_PTR(-ENOMEM);
 
index 41c89f5c616da2cc17e5e76ef2842483ecf9de07..73b38888a3041bbfcab55e86352fdd23a2a069e5 100644 (file)
@@ -1329,7 +1329,7 @@ void io_vec_free(struct iou_vec *iv)
 
 int io_vec_realloc(struct iou_vec *iv, unsigned nr_entries)
 {
-       gfp_t gfp = GFP_KERNEL | __GFP_NOWARN;
+       gfp_t gfp = GFP_KERNEL_ACCOUNT | __GFP_NOWARN;
        struct iovec *iov;
 
        iov = kmalloc_array(nr_entries, sizeof(iov[0]), gfp);