From c328e25c65b8a1d3e96b886bba35bed19eb330c0 Mon Sep 17 00:00:00 2001 From: Vincenzo Maffione Date: Mon, 25 Feb 2019 08:50:25 +0000 Subject: MFC r344253 netmap: don't schedule kqueue notify task when kqueue is not used This change adds a counter (kqueue_users) to keep track of how many kqueue users are referencing a given struct nm_selinfo. In this way, nm_os_selwakeup() can schedule the kevent notification task only when kqueue is actually being used. This is important to avoid wasting CPU in the common case where kqueue is not used. Reviewed by: Aleksandr Fedorov Differential Revision: https://reviews.freebsd.org/D19177 --- sys/dev/netmap/netmap_kern.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'sys/dev/netmap/netmap_kern.h') diff --git a/sys/dev/netmap/netmap_kern.h b/sys/dev/netmap/netmap_kern.h index f8db7a38ac9c..ef2b1bcf0fb5 100644 --- a/sys/dev/netmap/netmap_kern.h +++ b/sys/dev/netmap/netmap_kern.h @@ -132,11 +132,14 @@ struct netmap_adapter *netmap_getna(if_t ifp); #define MBUF_QUEUED(m) 1 struct nm_selinfo { + /* Support for select(2) and poll(2). */ struct selinfo si; + /* Support for kqueue(9). See comments in netmap_freebsd.c */ struct taskqueue *ntfytq; struct task ntfytask; struct mtx m; char mtxname[32]; + int kqueue_users; }; -- cgit v1.3