Skip to content

Commit e26f51f

Browse files
committed
io_uring/rsrc: use GFP_KERNEL_ACCOUNT consistently
For potential long term allocations, ensure that we play nicer with memcg and use the accounting variant of the GFP_KERNEL allocation. Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 6e0d71c commit e26f51f

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

io_uring/memmap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ struct page **io_pin_pages(unsigned long uaddr, unsigned long len, int *npages)
5656
if (WARN_ON_ONCE(nr_pages > INT_MAX))
5757
return ERR_PTR(-EOVERFLOW);
5858

59-
pages = kvmalloc_array(nr_pages, sizeof(struct page *), GFP_KERNEL);
59+
pages = kvmalloc_array(nr_pages, sizeof(struct page *), GFP_KERNEL_ACCOUNT);
6060
if (!pages)
6161
return ERR_PTR(-ENOMEM);
6262

io_uring/rsrc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1329,7 +1329,7 @@ void io_vec_free(struct iou_vec *iv)
13291329

13301330
int io_vec_realloc(struct iou_vec *iv, unsigned nr_entries)
13311331
{
1332-
gfp_t gfp = GFP_KERNEL | __GFP_NOWARN;
1332+
gfp_t gfp = GFP_KERNEL_ACCOUNT | __GFP_NOWARN;
13331333
struct iovec *iov;
13341334

13351335
iov = kmalloc_array(nr_entries, sizeof(iov[0]), gfp);

0 commit comments

Comments
 (0)