]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
io_uring: put provided buffer meta data under memcg accounting
authorJens Axboe <axboe@kernel.dk>
Fri, 24 Sep 2021 13:39:08 +0000 (07:39 -0600)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 5 Nov 2021 09:20:24 +0000 (10:20 +0100)
BugLink: https://bugs.launchpad.net/bugs/1949640
[ Upstream commit 9990da93d2bf9892c2c14c958bef050d4e461a1a ]

For each provided buffer, we allocate a struct io_buffer to hold the
data associated with it. As a large number of buffers can be provided,
account that data with memcg.

Fixes: ddf0322db79c ("io_uring: add IORING_OP_PROVIDE_BUFFERS")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
fs/io_uring.c

index 5265a45b64403d4dd7119b3a5dff4b76a529859f..b9353cf8aab9baacc60eb6a7d5fe0564a209aba8 100644 (file)
@@ -4275,7 +4275,7 @@ static int io_add_buffers(struct io_provide_buf *pbuf, struct io_buffer **head)
        int i, bid = pbuf->bid;
 
        for (i = 0; i < pbuf->nbufs; i++) {
-               buf = kmalloc(sizeof(*buf), GFP_KERNEL);
+               buf = kmalloc(sizeof(*buf), GFP_KERNEL_ACCOUNT);
                if (!buf)
                        break;