aboutsummaryrefslogtreecommitdiff
path: root/sys/sys
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2021-09-06 11:43:06 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2021-09-06 23:43:34 +0000
commit98168a6e6c12dab8f608f6b5f5b0b175d2b87ef0 (patch)
treed6aa38887d357bd670439acc4391b7e9345fff40 /sys/sys
parent936f4a42fa2a23d21f8f14a8c33627a8207b4b3b (diff)
downloadsrc-98168a6e6c12dab8f608f6b5f5b0b175d2b87ef0.tar.gz
src-98168a6e6c12dab8f608f6b5f5b0b175d2b87ef0.zip
kqueue: drain kqueue taskqueue if syscall tickled it
Otherwise return from the syscall and next syscall, which could be kevent(2) on the kqueue that should be notified, races with the kqueue taskqueue thread, and potentially misses the wakeup. This is reliably visible when kevent(2) only peeks into events using zeroed timeout. PR: 258310 Reported by: arichardson, Jan Kokemüller <jan.kokemueller@gmail.com> Reviewed by: arichardson, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D31858
Diffstat (limited to 'sys/sys')
-rw-r--r--sys/sys/event.h1
-rw-r--r--sys/sys/proc.h2
2 files changed, 2 insertions, 1 deletions
diff --git a/sys/sys/event.h b/sys/sys/event.h
index cf7db43475fd..80ed1268c8a1 100644
--- a/sys/sys/event.h
+++ b/sys/sys/event.h
@@ -349,6 +349,7 @@ int kqfd_register(int fd, struct kevent *kev, struct thread *p,
int mflag);
int kqueue_add_filteropts(int filt, struct filterops *filtops);
int kqueue_del_filteropts(int filt);
+void kqueue_drain_schedtask(void);
#else /* !_KERNEL */
diff --git a/sys/sys/proc.h b/sys/sys/proc.h
index 39ff1d95f80b..ddc8392481aa 100644
--- a/sys/sys/proc.h
+++ b/sys/sys/proc.h
@@ -451,7 +451,7 @@ do { \
#define TDF_ALLPROCSUSP 0x00000200 /* suspended by SINGLE_ALLPROC */
#define TDF_BOUNDARY 0x00000400 /* Thread suspended at user boundary */
#define TDF_ASTPENDING 0x00000800 /* Thread has some asynchronous events. */
-#define TDF_UNUSED12 0x00001000 /* --available-- */
+#define TDF_KQTICKLED 0x00001000 /* AST drain kqueue taskqueue */
#define TDF_SBDRY 0x00002000 /* Stop only on usermode boundary. */
#define TDF_UPIBLOCKED 0x00004000 /* Thread blocked on user PI mutex. */
#define TDF_NEEDSUSPCHK 0x00008000 /* Thread may need to suspend. */