Thread (60 messages) 60 messages, 6 authors, 2019-02-01

Re: [PATCH 05/18] Add io_uring IO interface

flat view

From: Jann Horn <jannh@google.com>
Date: 2019-01-29 01:33:17
Also in: linux-block, linux-man

On Tue, Jan 29, 2019 at 2:31 AM Jens Axboe [off-list ref] wrote:
On 1/28/19 6:29 PM, Jann Horn wrote:
quoted
On Mon, Jan 28, 2019 at 10:35 PM Jens Axboe [off-list ref] wrote:
quoted
The submission queue (SQ) and completion queue (CQ) rings are shared
between the application and the kernel. This eliminates the need to
copy data back and forth to submit and complete IO.
[...]
quoted
+static struct io_kiocb *io_get_req(struct io_ring_ctx *ctx)
+{
+       struct io_kiocb *req;
+
+       /* safe to use the non tryget, as we're inside ring ref already */
+       percpu_ref_get(&ctx->refs);
Is that true? In the path io_sq_thread() -> io_submit_sqes() ->
io_submit_sqe() -> io_get_req(), I don't see anything that's already
holding a reference for you. Is the worker thread holding a reference
somewhere that I'm missing?
If the thread is alive, then the ctx is alive. Before we drop the last
ref to the ctx (and kill it), we wait for the thread to exit.
Where in __io_uring_register() are you waiting for the thread to exit
before killing it? As far as I can tell, you come straight in from
syscall context, take a mutex, and do percpu_ref_kill().

--
To unsubscribe, send a message with 'unsubscribe linux-aio' in
the body to majordomo@kvack.org.  For more info on Linux AIO,
see: http://www.kvack.org/aio/
Don't email: <a href=mailto:"aart@kvack.org">aart@kvack.org</a>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help