Skip to contentSkip to conversation

io_uring/rsrc: use GFP_KERNEL_ACCOUNT consistently

PATCH New Jens Axboe 1 participant 1 message Jan 25 io_uring

lore
Share & tools
lore

Jens Axboe

author maintainer
#0 lore raw

PATCH 1/1 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.

---

io_uring/memmap.c +1 -1
index 18e574776ef6..81b527dc96f7 100644
@@ -56,7 +56,7 @@ struct page **io_pin_pages(unsigned long uaddr, unsigned long len, int *npages)
 	if (WARN_ON_ONCE(nr_pages > INT_MAX))
 		return ERR_PTR(-EOVERFLOW);
 
-	pages = kvmalloc_array(nr_pages, sizeof(struct page *), GFP_KERNEL);
+	pages = kvmalloc_array(nr_pages, sizeof(struct page *), GFP_KERNEL_ACCOUNT);
 	if (!pages)
 		return ERR_PTR(-ENOMEM);
 
io_uring/rsrc.c +1 -1
index 41c89f5c616d..73b38888a304 100644
@@ -1329,7 +1329,7 @@ void io_vec_free(struct iou_vec *iv)
 
 int io_vec_realloc(struct iou_vec *iv, unsigned nr_entries)
 {
-	gfp_t gfp = GFP_KERNEL | __GFP_NOWARN;
+	gfp_t gfp = GFP_KERNEL_ACCOUNT | __GFP_NOWARN;
 	struct iovec *iov;
 
 	iov = kmalloc_array(nr_entries, sizeof(iov[0]), gfp);
Signature · 1 line
Jens Axboe