public inbox for [email protected]
 help / color / mirror / Atom feed
From: Jens Axboe <[email protected]>
To: Xiaoguang Wang <[email protected]>,
	[email protected]
Cc: [email protected]
Subject: Re: [PATCH] io_uring: use cond_resched() in io_ring_ctx_wait_and_kill()
Date: Thu, 30 Apr 2020 19:32:59 -0600	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>

On 4/30/20 6:52 PM, Xiaoguang Wang wrote:
> While working on to make io_uring sqpoll mode support syscalls that need
> struct files_struct, I got cpu soft lockup in io_ring_ctx_wait_and_kill(),
>     while (ctx->sqo_thread && !wq_has_sleeper(&ctx->sqo_wait))
>         cpu_relax();
> above loop never has an chance to exit, it's because preempt isn't enabled
> in the kernel, and the context calling io_ring_ctx_wait_and_kill() and
> io_sq_thread() run in the same cpu, if io_sq_thread calls a cond_resched()
> yield cpu and another context enters above loop, then io_sq_thread() will
> always in runqueue and never exit.
> 
> Use cond_resched() can fix this issue.

Thanks, this looks good, I believe it should also fix the syzbot reported
issue so I added the tag for that.

-- 
Jens Axboe


      reply	other threads:[~2020-05-01  1:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-01  0:52 [PATCH] io_uring: use cond_resched() in io_ring_ctx_wait_and_kill() Xiaoguang Wang
2020-05-01  1:32 ` Jens Axboe [this message]

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 \
    [email protected] \
    [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