Race between SIGIO and epoll from SMP host

YiFei Zhu zhuyifei1999 at gmail.com
Wed Apr 21 14:35:53 BST 2021


On Wed, Apr 21, 2021 at 7:32 AM Anton Ivanov
<anton.ivanov at kot-begemot.co.uk> wrote:
> > Considering that this is a race on the host, what would be the best
> > way to fix this?
>
> Interesting one. I need to think.
>
> One option would be to wait for epoll events with a timeout which is larger than zero - f.e. HZ.

I was about to say I could reproduce it even with a timeout of 1ms,
then I realized that code I pasted above already used 1ms timeout.
Assertion failures using 1ms timeout seems much rarer than 0 timeout
however.

For reference my CONFIG_HZ on the host is 1000. I also use
CONFIG_NO_HZ_IDLE if that's relevant (I'm not too familiar with how
the kernel ticking works).

> If we have received a SIGIO there is an epoll event on the way. The fact that it is not in the queue right now means that we are due to process it shortly.
>
> A.

YiFei Zhu



More information about the linux-um mailing list