Re: io_uring and spurious wake-ups from eventfd

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 1/7/20 8:55 AM, Mark Papadakis wrote:
> This is perhaps an odd request, but if it’s trivial to implement
> support for this described feature, it could help others like it ‘d
> help me (I ‘ve been experimenting with io_uring for some time now).
> 
> Being able to register an eventfd with an io_uring context is very
> handy, if you e.g have some sort of reactor thread multiplexing I/O
> using epoll etc, where you want to be notified when there are pending
> CQEs to drain. The problem, such as it is, is that this can result in
> un-necessary/spurious wake-ups.
> 
> If, for example, you are monitoring some sockets for EPOLLIN, and when
> poll says you have pending bytes to read from their sockets, and said
> sockets are non-blocking, and for each some reported event you reserve
> an SQE for preadv() to read that data and then you io_uring_enter to
> submit the SQEs, because the data is readily available, as soon as
> io_uring_enter returns, you will have your completions available -
> which you can process.  The “problem” is that poll will wake up
> immediately thereafter in the next reactor loop iteration because
> eventfd was tripped (which is reasonable but un-necessary).
> 
> What if there was a flag for io_uring_setup() so that the eventfd
> would only be tripped for CQEs that were processed asynchronously, or,
> if that’s non-trivial, only for CQEs that reference file FDs?
> 
> That’d help with that spurious wake-up.

One easy way to do that would be for the application to signal that it
doesn't want eventfd notifications for certain requests. Like using an
IOSQE_ flag for that. Then you could set that on the requests you submit
in response to triggering an eventfd event.

-- 
Jens Axboe




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux