diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2018-06-04 22:08:57 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2018-06-04 22:08:57 +0000 |
commit | 9dd49cbfb3feaae549de554fac3c1bb6a8c331af (patch) | |
tree | bff5a9bd242d7abc990e805f0426d38366077743 /lib/libc | |
parent | d34db4e65d49ebbb15c735db50882b18c21c82e2 (diff) |
Use process-private futexes. This avoids the overhead of calling into uvm
to look up the mapping for the futex address.
ok visa@, mpi@
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/thread/synch.h | 12 |
1 files changed, 6 insertions, 6 deletions
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); } |