From 0291c72866b88200be7ba392d6b9fe6b46a8c87a Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Tue, 14 Feb 2017 22:06:00 +0100 Subject: Fix spurious epoll traffic * fibers/internal.scm (schedule-fibers-for-fd): Fix sense of the POLLERR test. This was causing us to register and unregister our fd's with the kernel all the time. This was a scalability bottleneck as adding or removing an fd from an epoll set is serialized in the kernel through one mutex (!!!!), the "epmutex"; because you can nest epoll instances the kernel uses this to prevent cycles. Hint found in Voellmy's paper on the MIO system for Haskell. --- fibers/internal.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fibers/internal.scm b/fibers/internal.scm index a495eb1..dceb5bf 100644 --- a/fibers/internal.scm +++ b/fibers/internal.scm @@ -238,7 +238,7 @@ thread." (resume-fiber (source-fiber source) (lambda () revents)))) (cdr sources)) (cond - ((zero? (logand revents EPOLLERR)) + ((not (zero? (logand revents EPOLLERR))) (hashv-remove! (scheduler-sources sched) fd) (epoll-remove! (scheduler-epfd sched) fd)) (else -- cgit v1.3