* [PATCH] io_uring: increase max number of reg buffers
@ 2021-05-14 11:06 Pavel Begunkov
2021-05-14 14:42 ` Jens Axboe
0 siblings, 1 reply; 4+ messages in thread
From: Pavel Begunkov @ 2021-05-14 11:06 UTC (permalink / raw)
To: Jens Axboe, io-uring
Since recent changes instead of storing a large array of struct
io_mapped_ubuf, we store pointers to them, that is 4 times slimmer and
we should not to so worry about restricting max number of registererd
buffer slots, increase the limit 4 times.
Signed-off-by: Pavel Begunkov <[email protected]>
---
fs/io_uring.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/fs/io_uring.c b/fs/io_uring.c
index 9ac5e278a91e..8f718d26f01c 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -100,6 +100,8 @@
#define IORING_MAX_RESTRICTIONS (IORING_RESTRICTION_LAST + \
IORING_REGISTER_LAST + IORING_OP_LAST)
+#define IORING_MAX_REG_BUFFERS (1U << 14)
+
#define SQE_VALID_FLAGS (IOSQE_FIXED_FILE|IOSQE_IO_DRAIN|IOSQE_IO_LINK| \
IOSQE_IO_HARDLINK | IOSQE_ASYNC | \
IOSQE_BUFFER_SELECT)
@@ -8390,7 +8392,7 @@ static int io_sqe_buffers_register(struct io_ring_ctx *ctx, void __user *arg,
if (ctx->user_bufs)
return -EBUSY;
- if (!nr_args || nr_args > UIO_MAXIOV)
+ if (!nr_args || nr_args > IORING_MAX_REG_BUFFERS)
return -EINVAL;
ret = io_rsrc_node_switch_start(ctx);
if (ret)
--
2.31.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] io_uring: increase max number of reg buffers
2021-05-14 11:06 [PATCH] io_uring: increase max number of reg buffers Pavel Begunkov
@ 2021-05-14 14:42 ` Jens Axboe
2021-05-14 14:51 ` Jens Axboe
2021-05-14 14:51 ` Pavel Begunkov
0 siblings, 2 replies; 4+ messages in thread
From: Jens Axboe @ 2021-05-14 14:42 UTC (permalink / raw)
To: Pavel Begunkov, io-uring
On 5/14/21 5:06 AM, Pavel Begunkov wrote:
> Since recent changes instead of storing a large array of struct
> io_mapped_ubuf, we store pointers to them, that is 4 times slimmer and
> we should not to so worry about restricting max number of registererd
> buffer slots, increase the limit 4 times.
Is this going to fall within the max kmalloc size?
--
Jens Axboe
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] io_uring: increase max number of reg buffers
2021-05-14 14:42 ` Jens Axboe
@ 2021-05-14 14:51 ` Jens Axboe
2021-05-14 14:51 ` Pavel Begunkov
1 sibling, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2021-05-14 14:51 UTC (permalink / raw)
To: Pavel Begunkov, io-uring
On 5/14/21 8:42 AM, Jens Axboe wrote:
> On 5/14/21 5:06 AM, Pavel Begunkov wrote:
>> Since recent changes instead of storing a large array of struct
>> io_mapped_ubuf, we store pointers to them, that is 4 times slimmer and
>> we should not to so worry about restricting max number of registererd
>> buffer slots, increase the limit 4 times.
>
> Is this going to fall within the max kmalloc size?
Ah yes, it's just a u64 now, so should be fine. Might be worth considering
using vmalloc() for this in any case in the future, to make the allocation
more reliable. 128K of contig memory can sometimes be an issue in prod.
--
Jens Axboe
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] io_uring: increase max number of reg buffers
2021-05-14 14:42 ` Jens Axboe
2021-05-14 14:51 ` Jens Axboe
@ 2021-05-14 14:51 ` Pavel Begunkov
1 sibling, 0 replies; 4+ messages in thread
From: Pavel Begunkov @ 2021-05-14 14:51 UTC (permalink / raw)
To: Jens Axboe, io-uring
On 5/14/21 3:42 PM, Jens Axboe wrote:
> On 5/14/21 5:06 AM, Pavel Begunkov wrote:
>> Since recent changes instead of storing a large array of struct
>> io_mapped_ubuf, we store pointers to them, that is 4 times slimmer and
>> we should not to so worry about restricting max number of registererd
>> buffer slots, increase the limit 4 times.
>
> Is this going to fall within the max kmalloc size?
>
2^14 * 8 bytes = 128KB or 32 pages,
Even though 128KB may be not nice, but should be way below max
limit. On the other hand that's the same amount of memory we were
allowing prior to dynamic buffer changes.
--
Pavel Begunkov
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-05-14 14:51 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-05-14 11:06 [PATCH] io_uring: increase max number of reg buffers Pavel Begunkov
2021-05-14 14:42 ` Jens Axboe
2021-05-14 14:51 ` Jens Axboe
2021-05-14 14:51 ` Pavel Begunkov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox