提交 4f326107 编写于 作者: P Pavel Begunkov 提交者: Zheng Zengkai

io_uring: place fixed tables under memcg limits

stable inclusion
from stable-5.10.67
commit a3ed34bcada565ccd33fc61360fd8157c32b5636
bugzilla: 182619 https://gitee.com/openeuler/kernel/issues/I4EWO7

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=a3ed34bcada565ccd33fc61360fd8157c32b5636

--------------------------------

commit 0bea96f5 upstream.

Fixed tables may be large enough, place all of them together with
allocated tags under memcg limits.

Cc: stable@vger.kernel.org
Signed-off-by: NPavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/b3ac9f5da9821bb59837b5fe25e8ef4be982218c.1629451684.git.asml.silence@gmail.comSigned-off-by: NJens Axboe <axboe@kernel.dk>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Acked-by: NWeilong Chen <chenweilong@huawei.com>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 1feab377
......@@ -7386,7 +7386,7 @@ static int io_sqe_alloc_file_tables(struct fixed_file_data *file_data,
this_files = min(nr_files, IORING_MAX_FILES_TABLE);
table->files = kcalloc(this_files, sizeof(struct file *),
GFP_KERNEL);
GFP_KERNEL_ACCOUNT);
if (!table->files)
break;
nr_files -= this_files;
......@@ -7585,7 +7585,7 @@ static int io_sqe_files_register(struct io_ring_ctx *ctx, void __user *arg,
if (nr_args > rlimit(RLIMIT_NOFILE))
return -EMFILE;
file_data = kzalloc(sizeof(*ctx->file_data), GFP_KERNEL);
file_data = kzalloc(sizeof(*ctx->file_data), GFP_KERNEL_ACCOUNT);
if (!file_data)
return -ENOMEM;
file_data->ctx = ctx;
......@@ -7595,7 +7595,7 @@ static int io_sqe_files_register(struct io_ring_ctx *ctx, void __user *arg,
nr_tables = DIV_ROUND_UP(nr_args, IORING_MAX_FILES_TABLE);
file_data->table = kcalloc(nr_tables, sizeof(*file_data->table),
GFP_KERNEL);
GFP_KERNEL_ACCOUNT);
if (!file_data->table)
goto out_free;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册