mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-07 10:29:52 +00:00
io_uring: place fixed tables under memcg limits
commit 0bea96f59b 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: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/b3ac9f5da9821bb59837b5fe25e8ef4be982218c.1629451684.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
a71001a193
commit
3e433e671e
@@ -7126,14 +7126,14 @@ static void **io_alloc_page_table(size_t size)
|
|||||||
size_t init_size = size;
|
size_t init_size = size;
|
||||||
void **table;
|
void **table;
|
||||||
|
|
||||||
table = kcalloc(nr_tables, sizeof(*table), GFP_KERNEL);
|
table = kcalloc(nr_tables, sizeof(*table), GFP_KERNEL_ACCOUNT);
|
||||||
if (!table)
|
if (!table)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
for (i = 0; i < nr_tables; i++) {
|
for (i = 0; i < nr_tables; i++) {
|
||||||
unsigned int this_size = min_t(size_t, size, PAGE_SIZE);
|
unsigned int this_size = min_t(size_t, size, PAGE_SIZE);
|
||||||
|
|
||||||
table[i] = kzalloc(this_size, GFP_KERNEL);
|
table[i] = kzalloc(this_size, GFP_KERNEL_ACCOUNT);
|
||||||
if (!table[i]) {
|
if (!table[i]) {
|
||||||
io_free_page_table(table, init_size);
|
io_free_page_table(table, init_size);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
Reference in New Issue
Block a user