The branch main has been updated by trasz:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=ae71b794cbed19e5e25effc3438720ad452ab87c

commit ae71b794cbed19e5e25effc3438720ad452ab87c
Author:     shu <anko...@outlook.com>
AuthorDate: 2021-02-03 16:51:45 +0000
Commit:     Edward Tomasz Napierala <tr...@freebsd.org>
CommitDate: 2021-02-03 19:08:40 +0000

    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 | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sys/compat/linux/linux_event.c b/sys/compat/linux/linux_event.c
index dfb4588392cc..54f6b083adf3 100644
--- a/sys/compat/linux/linux_event.c
+++ b/sys/compat/linux/linux_event.c
@@ -981,6 +981,7 @@ linux_timerfd_settime(struct thread *td, struct 
linux_timerfd_settime_args *args
                linux_timerfd_curval(tfd, &ots);
 
        tfd->tfd_time = nts;
+       tfd->tfd_count = 0;
        if (timespecisset(&nts.it_value)) {
                linux_timerfd_clocktime(tfd, &cts);
                ts = nts.it_value;
_______________________________________________
dev-commits-src-main@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "dev-commits-src-main-unsubscr...@freebsd.org"

Reply via email to