summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2016-04-08 10:21:43 +0000
committerkib <kib@FreeBSD.org>2016-04-08 10:21:43 +0000
commit21446f2890b124fd46c7f3b1244f0f24d80670b3 (patch)
treef9ffd2a1454f197b9f128f06e224492882967f53
parente099b3defecad889c8551888e1fb721a4dedab27 (diff)
downloadFreeBSD-src-21446f2890b124fd46c7f3b1244f0f24d80670b3.zip
FreeBSD-src-21446f2890b124fd46c7f3b1244f0f24d80670b3.tar.gz
Assert that the lock objects put into the off-page, fit into the page.
Sponsored by: The FreeBSD Foundation
-rw-r--r--lib/libthr/thread/thr_barrier.c3
-rw-r--r--lib/libthr/thread/thr_cond.c3
-rw-r--r--lib/libthr/thread/thr_mutex.c3
-rw-r--r--lib/libthr/thread/thr_pspinlock.c3
-rw-r--r--lib/libthr/thread/thr_rwlock.c3
5 files changed, 15 insertions, 0 deletions
diff --git a/lib/libthr/thread/thr_barrier.c b/lib/libthr/thread/thr_barrier.c
index 45ca41a..ad4477d 100644
--- a/lib/libthr/thread/thr_barrier.c
+++ b/lib/libthr/thread/thr_barrier.c
@@ -34,6 +34,9 @@
#include "thr_private.h"
+_Static_assert(sizeof(struct pthread_barrier) <= PAGE_SIZE,
+ "pthread_barrier is too large for off-page");
+
__weak_reference(_pthread_barrier_init, pthread_barrier_init);
__weak_reference(_pthread_barrier_wait, pthread_barrier_wait);
__weak_reference(_pthread_barrier_destroy, pthread_barrier_destroy);
diff --git a/lib/libthr/thread/thr_cond.c b/lib/libthr/thread/thr_cond.c
index 934f9a0..13487bf 100644
--- a/lib/libthr/thread/thr_cond.c
+++ b/lib/libthr/thread/thr_cond.c
@@ -40,6 +40,9 @@
#include "thr_private.h"
+_Static_assert(sizeof(struct pthread_cond) <= PAGE_SIZE,
+ "pthread_cond too large");
+
/*
* Prototypes
*/
diff --git a/lib/libthr/thread/thr_mutex.c b/lib/libthr/thread/thr_mutex.c
index 865e4cf..f732a63 100644
--- a/lib/libthr/thread/thr_mutex.c
+++ b/lib/libthr/thread/thr_mutex.c
@@ -51,6 +51,9 @@
#include "thr_private.h"
+_Static_assert(sizeof(struct pthread_mutex) <= PAGE_SIZE,
+ "pthread_mutex is too large for off-page");
+
/*
* For adaptive mutexes, how many times to spin doing trylock2
* before entering the kernel to block
diff --git a/lib/libthr/thread/thr_pspinlock.c b/lib/libthr/thread/thr_pspinlock.c
index 1c9b412..124e97b 100644
--- a/lib/libthr/thread/thr_pspinlock.c
+++ b/lib/libthr/thread/thr_pspinlock.c
@@ -38,6 +38,9 @@
#include "thr_private.h"
+_Static_assert(sizeof(struct pthread_spinlock) <= PAGE_SIZE,
+ "pthread_spinlock is too large for off-page");
+
#define SPIN_COUNT 100000
__weak_reference(_pthread_spin_init, pthread_spin_init);
diff --git a/lib/libthr/thread/thr_rwlock.c b/lib/libthr/thread/thr_rwlock.c
index aadd0e9..8e9fd73 100644
--- a/lib/libthr/thread/thr_rwlock.c
+++ b/lib/libthr/thread/thr_rwlock.c
@@ -35,6 +35,9 @@
#include "un-namespace.h"
#include "thr_private.h"
+_Static_assert(sizeof(struct pthread_rwlock) <= PAGE_SIZE,
+ "pthread_rwlock is too large for off-page");
+
__weak_reference(_pthread_rwlock_destroy, pthread_rwlock_destroy);
__weak_reference(_pthread_rwlock_init, pthread_rwlock_init);
__weak_reference(_pthread_rwlock_rdlock, pthread_rwlock_rdlock);
OpenPOWER on IntegriCloud