io-uring.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: Pavel Begunkov <asml.silence@gmail.com>,
	io-uring <io-uring@vger.kernel.org>
Subject: Re: [PATCH] io_uring: trigger worker exit when ring is exiting
Date: Thu, 2 Sep 2021 12:08:30 -0600	[thread overview]
Message-ID: <0d9cf759-98fc-334a-e6ab-c9605dc3a8af@kernel.dk> (raw)
In-Reply-To: <0a7dbae3-e48e-bf8c-1959-59195cad4bcf@gmail.com>

On 9/2/21 12:04 PM, Pavel Begunkov wrote:
> On 9/2/21 6:56 PM, Jens Axboe wrote:
>> If a task exits normally, then the teardown of async workers happens
>> quickly. But if it simply closes the ring fd, then the async teardown
>> ends up waiting for workers to timeout if they are sleeping, which can
>> then take up to 5 seconds (by default). This isn't a big issue as this
>> happens off the workqueue path, but let's be nicer and ensure that we
>> exit as quick as possible.
> 
> ring = io_uring_init();
> ...
> io_uring_close(&ring); // triggers io_ring_ctx_wait_and_kill()
> rint2 = io_uring_init();
> ...
> 
> It looks IO_WQ_BIT_EXIT there will be troublesome.

I wonder if we can get by with just a wakeup. Let me test...

-- 
Jens Axboe


  reply	other threads:[~2021-09-02 18:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-02 17:56 Jens Axboe
2021-09-02 18:04 ` Pavel Begunkov
2021-09-02 18:08   ` Jens Axboe [this message]
2021-09-02 18:19     ` Jens Axboe

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=0d9cf759-98fc-334a-e6ab-c9605dc3a8af@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=asml.silence@gmail.com \
    --cc=io-uring@vger.kernel.org \
    --subject='Re: [PATCH] io_uring: trigger worker exit when ring is exiting' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).