io_uring: enable kmemcg account for io_uring requests
authorJens Axboe <axboe@kernel.dk>
Tue, 9 Feb 2021 20:48:50 +0000 (13:48 -0700)
committerJens Axboe <axboe@kernel.dk>
Wed, 10 Feb 2021 14:33:15 +0000 (07:33 -0700)
This puts io_uring under the memory cgroups accounting and limits for
requests.

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

index 2c7ff0b..bffed6a 100644 (file)
@@ -10350,7 +10350,8 @@ static int __init io_uring_init(void)
 
        BUILD_BUG_ON(ARRAY_SIZE(io_op_defs) != IORING_OP_LAST);
        BUILD_BUG_ON(__REQ_F_LAST_BIT >= 8 * sizeof(int));
-       req_cachep = KMEM_CACHE(io_kiocb, SLAB_HWCACHE_ALIGN | SLAB_PANIC);
+       req_cachep = KMEM_CACHE(io_kiocb, SLAB_HWCACHE_ALIGN | SLAB_PANIC |
+                               SLAB_ACCOUNT);
        return 0;
 };
 __initcall(io_uring_init);