]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
linux: make timerfd_settime(2) set expirations count to zero
authorshu <ankohuu@outlook.com>
Wed, 3 Feb 2021 16:51:45 +0000 (16:51 +0000)
committerEdward Tomasz Napierala <trasz@FreeBSD.org>
Wed, 3 Feb 2021 19:08:40 +0000 (19:08 +0000)
commitae71b794cbed19e5e25effc3438720ad452ab87c
tree1f5f6b91628230f7b11bd437181020ae8c0e4b61
parent43e083be8103685e65582e002d33e861f7d5c794
linux: make timerfd_settime(2) set expirations count to zero

On Linux, read(2) from a timerfd file descriptor returns an unsigned
8-byte integer (uint64_t) containing the number of expirations
that have occurred, if the timer has already expired one or more
times since its settings were last modified using timerfd_settime(),
or since the last successful read(2).  That's to say, once we do
a read or call timerfd_settime(), timer fd's expiration count should
be zero.  Some Linux applications create timerfd and add it to epoll
with LT mode, when event comes, they do timerfd_settime instead
of read to stop event source from trigger.  On FreeBSD,
timerfd_settime(2) didn't set the count to zero, which caused high
CPU utilization.

Submitted by: ankohuu_outlook.com (Shunchao Hu)
Differential Revision: https://reviews.freebsd.org/D28231
sys/compat/linux/linux_event.c