public inbox for [email protected]
 help / color / mirror / Atom feed
* [PATCH 1/1] io_uring: mem-account pbuf buckets
@ 2022-08-04 14:13 Pavel Begunkov
  2022-08-04 14:53 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Pavel Begunkov @ 2022-08-04 14:13 UTC (permalink / raw)
  To: io-uring; +Cc: Jens Axboe, asml.silence

Potentially, someone may create as many pbuf bucket as there are indexes
in an xarray without any other restrictions bounding our memory usage,
put memory needed for the buckets under memory accounting.

Cc: <[email protected]>
Signed-off-by: Pavel Begunkov <[email protected]>
---
 io_uring/kbuf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/io_uring/kbuf.c b/io_uring/kbuf.c
index e538fa7cb727..a73f40a4cfe6 100644
--- a/io_uring/kbuf.c
+++ b/io_uring/kbuf.c
@@ -436,7 +436,7 @@ int io_provide_buffers(struct io_kiocb *req, unsigned int issue_flags)
 
 	bl = io_buffer_get_list(ctx, p->bgid);
 	if (unlikely(!bl)) {
-		bl = kzalloc(sizeof(*bl), GFP_KERNEL);
+		bl = kzalloc(sizeof(*bl), GFP_KERNEL_ACCOUNT);
 		if (!bl) {
 			ret = -ENOMEM;
 			goto err;
-- 
2.37.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/1] io_uring: mem-account pbuf buckets
  2022-08-04 14:13 [PATCH 1/1] io_uring: mem-account pbuf buckets Pavel Begunkov
@ 2022-08-04 14:53 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2022-08-04 14:53 UTC (permalink / raw)
  To: io-uring, asml.silence

On Thu, 4 Aug 2022 15:13:46 +0100, Pavel Begunkov wrote:
> Potentially, someone may create as many pbuf bucket as there are indexes
> in an xarray without any other restrictions bounding our memory usage,
> put memory needed for the buckets under memory accounting.
> 
> 

Applied, thanks!

[1/1] io_uring: mem-account pbuf buckets
      commit: cc18cc5e82033d406f54144ad6f8092206004684

Best regards,
-- 
Jens Axboe



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-08-04 14:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-04 14:13 [PATCH 1/1] io_uring: mem-account pbuf buckets Pavel Begunkov
2022-08-04 14:53 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox