Author: kib Date: Fri Apr 8 10:21:43 2016 New Revision: 297701 URL: https://svnweb.freebsd.org/changeset/base/297701
Log: Assert that the lock objects put into the off-page, fit into the page. Sponsored by: The FreeBSD Foundation Modified: head/lib/libthr/thread/thr_barrier.c head/lib/libthr/thread/thr_cond.c head/lib/libthr/thread/thr_mutex.c head/lib/libthr/thread/thr_pspinlock.c head/lib/libthr/thread/thr_rwlock.c Modified: head/lib/libthr/thread/thr_barrier.c ============================================================================== --- head/lib/libthr/thread/thr_barrier.c Fri Apr 8 10:00:07 2016 (r297700) +++ head/lib/libthr/thread/thr_barrier.c Fri Apr 8 10:21:43 2016 (r297701) @@ -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); Modified: head/lib/libthr/thread/thr_cond.c ============================================================================== --- head/lib/libthr/thread/thr_cond.c Fri Apr 8 10:00:07 2016 (r297700) +++ head/lib/libthr/thread/thr_cond.c Fri Apr 8 10:21:43 2016 (r297701) @@ -40,6 +40,9 @@ #include "thr_private.h" +_Static_assert(sizeof(struct pthread_cond) <= PAGE_SIZE, + "pthread_cond too large"); + /* * Prototypes */ Modified: head/lib/libthr/thread/thr_mutex.c ============================================================================== --- head/lib/libthr/thread/thr_mutex.c Fri Apr 8 10:00:07 2016 (r297700) +++ head/lib/libthr/thread/thr_mutex.c Fri Apr 8 10:21:43 2016 (r297701) @@ -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 Modified: head/lib/libthr/thread/thr_pspinlock.c ============================================================================== --- head/lib/libthr/thread/thr_pspinlock.c Fri Apr 8 10:00:07 2016 (r297700) +++ head/lib/libthr/thread/thr_pspinlock.c Fri Apr 8 10:21:43 2016 (r297701) @@ -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); Modified: head/lib/libthr/thread/thr_rwlock.c ============================================================================== --- head/lib/libthr/thread/thr_rwlock.c Fri Apr 8 10:00:07 2016 (r297700) +++ head/lib/libthr/thread/thr_rwlock.c Fri Apr 8 10:21:43 2016 (r297701) @@ -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); _______________________________________________ [email protected] mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "[email protected]"
