From: yang lan <[email protected]>
To: Pavel Begunkov <[email protected]>
Cc: [email protected], Jens Axboe <[email protected]>
Subject: Re: [PATCH 1/1] io_uring: more graceful request alloc OOM
Date: Sat, 20 May 2023 17:38:20 +0800 [thread overview]
Message-ID: <CAAehj2nmnN98ZYzcFMR0DsKXqEM7L8DH8SM4NusPqzoHu_VNPw@mail.gmail.com> (raw)
In-Reply-To: <3e79156a106e8b5b3646672656f738ba157957ef.1684505086.git.asml.silence@gmail.com>
Hi,
Thanks for your response.
But I applied this patch to LTS kernel 5.10.180, it can still trigger this bug.
--- io_uring/io_uring.c.back 2023-05-20 17:11:25.870550438 +0800
+++ io_uring/io_uring.c 2023-05-20 16:35:24.265846283 +0800
@@ -1970,7 +1970,7 @@
static struct io_kiocb *io_alloc_req(struct io_ring_ctx *ctx)
__must_hold(&ctx->uring_lock)
{
struct io_submit_state *state = &ctx->submit_state;
- gfp_t gfp = GFP_KERNEL | __GFP_NOWARN;
+ gfp_t gfp = GFP_KERNEL | __GFP_NOWARN | __GFP_NORETRY;
int ret, i;
BUILD_BUG_ON(ARRAY_SIZE(state->reqs) < IO_REQ_ALLOC_BATCH);
The io_uring.c.back is the original file.
Do I apply this patch wrong?
Regards,
Yang
Pavel Begunkov <[email protected]> 于2023年5月19日周五 22:06写道:
>
> It's ok for io_uring request allocation to fail, however there are
> reports that it starts killing tasks instead of just returning back
> to the userspace. Add __GFP_NORETRY, so it doesn't trigger OOM killer.
>
> Cc: [email protected]
> Fixes: 2b188cc1bb857 ("Add io_uring IO interface")
> Reported-by: yang lan <[email protected]>
> Signed-off-by: Pavel Begunkov <[email protected]>
> ---
> io_uring/io_uring.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
> index dab09f568294..ad34a4320dab 100644
> --- a/io_uring/io_uring.c
> +++ b/io_uring/io_uring.c
> @@ -1073,7 +1073,7 @@ static void io_flush_cached_locked_reqs(struct io_ring_ctx *ctx,
> __cold bool __io_alloc_req_refill(struct io_ring_ctx *ctx)
> __must_hold(&ctx->uring_lock)
> {
> - gfp_t gfp = GFP_KERNEL | __GFP_NOWARN;
> + gfp_t gfp = GFP_KERNEL | __GFP_NOWARN | __GFP_NORETRY;
> void *reqs[IO_REQ_ALLOC_BATCH];
> int ret, i;
>
> --
> 2.40.0
>
next prev parent reply other threads:[~2023-05-20 9:38 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-19 14:05 [PATCH 1/1] io_uring: more graceful request alloc OOM Pavel Begunkov
2023-05-20 1:57 ` Jens Axboe
2023-05-20 9:38 ` yang lan [this message]
2023-05-22 0:40 ` Pavel Begunkov
2023-05-22 7:55 ` yang lan
2023-05-23 12:08 ` Pavel Begunkov
2023-05-24 3:15 ` yang lan
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=CAAehj2nmnN98ZYzcFMR0DsKXqEM7L8DH8SM4NusPqzoHu_VNPw@mail.gmail.com \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
/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