linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stefano Garzarella <sgarzare@redhat.com>
To: Jens Axboe <axboe@kernel.dk>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>,
	io-uring@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-fsdevel@vger.kernel.org
Subject: [PATCH] io_uring: wakeup threads waiting for EPOLLOUT events
Date: Thu, 16 Jan 2020 14:49:46 +0100	[thread overview]
Message-ID: <20200116134946.184711-1-sgarzare@redhat.com> (raw)

io_uring_poll() sets EPOLLOUT flag if there is space in the
SQ ring, then we should wakeup threads waiting for EPOLLOUT
events when we expose the new SQ head to the userspace.

Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
---

Do you think is better to change the name of 'cq_wait' and 'cq_fasync'?

Thanks,
Stefano
---
 fs/io_uring.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/fs/io_uring.c b/fs/io_uring.c
index 38b54051facd..5c6ff5f9e741 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -3687,6 +3687,11 @@ static void io_commit_sqring(struct io_ring_ctx *ctx)
 		 * write new data to them.
 		 */
 		smp_store_release(&rings->sq.head, ctx->cached_sq_head);
+
+		if (wq_has_sleeper(&ctx->cq_wait)) {
+			wake_up_interruptible(&ctx->cq_wait);
+			kill_fasync(&ctx->cq_fasync, SIGIO, POLL_OUT);
+		}
 	}
 }
 
-- 
2.24.1


             reply	other threads:[~2020-01-16 13:49 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-16 13:49 Stefano Garzarella [this message]
2020-01-16 15:29 ` [PATCH] io_uring: wakeup threads waiting for EPOLLOUT events Jens Axboe
2020-01-16 15:55   ` Stefano Garzarella
2020-01-16 16:00     ` Jens Axboe
2020-01-16 16:26       ` Stefano Garzarella
2020-01-16 16:30         ` Jens Axboe
2020-01-16 17:03           ` Stefano Garzarella
2020-01-23 19:13             ` Jens Axboe
2020-01-23 21:45               ` Stefano Garzarella
2020-01-24  1:28                 ` 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=20200116134946.184711-1-sgarzare@redhat.com \
    --to=sgarzare@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=io-uring@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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;
as well as URLs for NNTP newsgroup(s).