From: Jens Axboe <axboe@kernel.dk>
To: io-uring <io-uring@vger.kernel.org>
Subject: [PATCH for-next] io_uring/rsrc: use GFP_KERNEL_ACCOUNT consistently
Date: Sun, 25 Jan 2026 10:09:21 -0700 [thread overview]
Message-ID: <0ee9c7b1-fd49-4170-8672-b37e83ccded3@kernel.dk> (raw)
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>
---
diff --git a/io_uring/memmap.c b/io_uring/memmap.c
index 18e574776ef6..81b527dc96f7 100644
--- a/io_uring/memmap.c
+++ b/io_uring/memmap.c
@@ -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);
diff --git a/io_uring/rsrc.c b/io_uring/rsrc.c
index 41c89f5c616d..73b38888a304 100644
--- a/io_uring/rsrc.c
+++ b/io_uring/rsrc.c
@@ -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);
--
Jens Axboe
reply other threads:[~2026-01-25 17:09 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0ee9c7b1-fd49-4170-8672-b37e83ccded3@kernel.dk \
--to=axboe@kernel.dk \
--cc=io-uring@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox