public inbox for [email protected]
 help / color / mirror / Atom feed
From: Jiufei Xue <[email protected]>
To: [email protected]
Cc: [email protected], [email protected]
Subject: [PATCH v3 2/2] io_uring: use EPOLLEXCLUSIVE flag to aoid thundering herd type behavior
Date: Fri, 12 Jun 2020 10:30:18 +0800	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>

Applications can pass this flag in to avoid accept thundering herd.

Signed-off-by: Jiufei Xue <[email protected]>
---
 fs/io_uring.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/fs/io_uring.c b/fs/io_uring.c
index 6250227..03951ec 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -4289,7 +4289,11 @@ static void __io_queue_proc(struct io_poll_iocb *poll, struct io_poll_table *pt,
 
 	pt->error = 0;
 	poll->head = head;
-	add_wait_queue(head, &poll->wait);
+
+	if (poll->events & EPOLLEXCLUSIVE)
+		add_wait_queue_exclusive(head, &poll->wait);
+	else
+		add_wait_queue(head, &poll->wait);
 }
 
 static void io_async_queue_proc(struct file *file, struct wait_queue_head *head,
@@ -4612,7 +4616,8 @@ static int io_poll_add_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe
 		return -EBADF;
 
 	events = READ_ONCE(sqe->poll_events);
-	poll->events = demangle_poll(events) | EPOLLERR | EPOLLHUP;
+	poll->events = demangle_poll(events) | EPOLLERR | EPOLLHUP |
+		       (events & EPOLLEXCLUSIVE);
 
 	get_task_struct(current);
 	req->task = current;
-- 
1.8.3.1


      parent reply	other threads:[~2020-06-12  2:30 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-12  2:30 [PATCH v3] io_uring: add EPOLLEXCLUSIVE flag for POLL_ADD operation Jiufei Xue
2020-06-12  2:30 ` [PATCH v3 1/2] io_uring: change the poll events to be 32-bits Jiufei Xue
2020-06-12 14:58   ` Jens Axboe
2020-06-12 16:48     ` Jens Axboe
2020-06-15  2:49       ` Jiufei Xue
2020-06-15 15:09         ` Jens Axboe
2020-06-16  3:04           ` Jiufei Xue
2020-06-16 13:58             ` Jens Axboe
2020-06-16 18:45               ` Jens Axboe
2020-06-16 19:20                 ` Pavel Begunkov
2020-06-16 19:27                   ` Jens Axboe
2020-06-16 19:21                 ` Jens Axboe
2020-06-16 21:46                   ` Pavel Begunkov
2020-06-17  0:06                     ` Jens Axboe
2020-06-17  1:39                     ` Jiufei Xue
2020-06-12  2:30 ` Jiufei Xue [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 \
    --in-reply-to=1591929018-73954-3-git-send-email-jiufei.xue@linux.alibaba.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