From 9dd49cbfb3feaae549de554fac3c1bb6a8c331af Mon Sep 17 00:00:00 2001 From: Mark Kettenis Date: Mon, 4 Jun 2018 22:08:57 +0000 Subject: Use process-private futexes. This avoids the overhead of calling into uvm to look up the mapping for the futex address. ok visa@, mpi@ --- lib/libc/thread/synch.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'lib/libc/thread/synch.h') diff --git a/lib/libc/thread/synch.h b/lib/libc/thread/synch.h index 8ab379530e8..242e579f323 100644 --- a/lib/libc/thread/synch.h +++ b/lib/libc/thread/synch.h @@ -1,4 +1,4 @@ -/* $OpenBSD: synch.h,v 1.2 2017/09/05 02:40:54 guenther Exp $ */ +/* $OpenBSD: synch.h,v 1.3 2018/06/04 22:08:56 kettenis Exp $ */ /* * Copyright (c) 2017 Martin Pieuchot * @@ -22,14 +22,14 @@ static inline int _wake(volatile uint32_t *p, int n) { - return futex(p, FUTEX_WAKE, n, NULL, NULL); + return futex(p, FUTEX_WAKE_PRIVATE, n, NULL, NULL); } static inline void _wait(volatile uint32_t *p, int val) { while (*p != (uint32_t)val) - futex(p, FUTEX_WAIT, val, NULL, NULL); + futex(p, FUTEX_WAIT_PRIVATE, val, NULL, NULL); } static inline int @@ -38,7 +38,7 @@ _twait(volatile uint32_t *p, int val, clockid_t clockid, const struct timespec * struct timespec rel; if (abs == NULL) - return futex(p, FUTEX_WAIT, val, NULL, NULL); + return futex(p, FUTEX_WAIT_PRIVATE, val, NULL, NULL); if (abs->tv_nsec >= 1000000000 || clock_gettime(clockid, &rel)) return (EINVAL); @@ -51,11 +51,11 @@ _twait(volatile uint32_t *p, int val, clockid_t clockid, const struct timespec * if (rel.tv_sec < 0) return (ETIMEDOUT); - return futex(p, FUTEX_WAIT, val, &rel, NULL); + return futex(p, FUTEX_WAIT_PRIVATE, val, &rel, NULL); } static inline int _requeue(volatile uint32_t *p, int n, int m, volatile uint32_t *q) { - return futex(p, FUTEX_REQUEUE, n, (void *)(long)m, q); + return futex(p, FUTEX_REQUEUE_PRIVATE, n, (void *)(long)m, q); } -- cgit v1.2.3