public inbox for [email protected]
 help / color / mirror / Atom feed
* [PATCH] io_uring: add EPOLLEXCLUSIVE flag to aoid thundering herd type behavior
@ 2020-06-10  6:15 Jiufei Xue
  2020-06-11  0:01 ` Jens Axboe
  0 siblings, 1 reply; 4+ messages in thread
From: Jiufei Xue @ 2020-06-10  6:15 UTC (permalink / raw)
  To: io-uring; +Cc: axboe, joseph.qi

Applications can use this flag to avoid accept thundering herd.

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

diff --git a/fs/io_uring.c b/fs/io_uring.c
index f668982..b8102b2 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -4109,7 +4109,10 @@ 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,
@@ -4530,7 +4533,7 @@ 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 | EPOLLEXCLUSIVE;
 
 	get_task_struct(current);
 	req->task = current;
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-06-11  1:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-06-10  6:15 [PATCH] io_uring: add EPOLLEXCLUSIVE flag to aoid thundering herd type behavior Jiufei Xue
2020-06-11  0:01 ` Jens Axboe
2020-06-11  1:36   ` Jiufei Xue
2020-06-11  1:40     ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox