]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
io_uring: account drain memory to cgroup
authorPavel Begunkov <asml.silence@gmail.com>
Fri, 9 May 2025 11:12:47 +0000 (12:12 +0100)
committerJens Axboe <axboe@kernel.dk>
Fri, 9 May 2025 14:01:01 +0000 (08:01 -0600)
Account drain allocations against memcg. It's not a big problem as each
such allocation is paired with a request, which is accounted, but it's
nicer to follow the limits more closely.

Cc: stable@vger.kernel.org # 6.1
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/f8dfdbd755c41fd9c75d12b858af07dfba5bbb68.1746788718.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
io_uring/io_uring.c

index 4034b1db7135a0c98a24df7c5eb85aab88f8133b..76b33762a28de14667e62ee49fe94a04ba42cbad 100644 (file)
@@ -1675,7 +1675,7 @@ queue:
        spin_unlock(&ctx->completion_lock);
 
        io_prep_async_link(req);
-       de = kmalloc(sizeof(*de), GFP_KERNEL);
+       de = kmalloc(sizeof(*de), GFP_KERNEL_ACCOUNT);
        if (!de) {
                ret = -ENOMEM;
                io_req_defer_failed(req, ret);