]> 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)
committerDmitry Chagin <dchagin@FreeBSD.org>
Fri, 19 Mar 2021 18:36:11 +0000 (21:36 +0300)
commit0cb6fa6acc93231242ef40e77518a9016ef4076a
tree8c90e11208ae9bb01d6d56b9988cbd19e43fa251
parentebee42edc86c0864d4a9b09ae4dae32cca7a996f
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

(cherry picked from commit ae71b794cbed19e5e25effc3438720ad452ab87c)
sys/compat/linux/linux_event.c