==== //depot/vendor/freebsd/src/sys/kern/kern_condvar.c#45 (text+ko) - //depot/user/attilio/attilio_smpng/kern/kern_condvar.c#2 (text+ko) ==== content
@@ -149,7 +149,8 @@
 	DROP_GIANT();
 	mtx_unlock(mp);
 
-	sleepq_add(cvp, mp, cvp->cv_description, SLEEPQ_CONDVAR);
+	sleepq_add(cvp, mp, cvp->cv_description, SLEEPQ_CONDVAR,
+	    SQ_EXCLUSIVE_LOCK);
 	sleepq_wait(cvp);
 
 	PICKUP_GIANT();
@@ -197,7 +198,7 @@
 	mtx_unlock(mp);
 
 	sleepq_add(cvp, mp, cvp->cv_description, SLEEPQ_CONDVAR |
-	    SLEEPQ_INTERRUPTIBLE);
+	    SLEEPQ_INTERRUPTIBLE, SQ_EXCLUSIVE_LOCK);
 	rval = sleepq_wait_sig(cvp);
 
 #ifdef KTRACE
@@ -250,7 +251,8 @@
 	DROP_GIANT();
 	mtx_unlock(mp);
 
-	sleepq_add(cvp, mp, cvp->cv_description, SLEEPQ_CONDVAR);
+	sleepq_add(cvp, mp, cvp->cv_description, SLEEPQ_CONDVAR,
+	    SQ_EXCLUSIVE_LOCK);
 	sleepq_set_timeout(cvp, timo);
 	rval = sleepq_timedwait(cvp);
 
@@ -308,7 +310,7 @@
 	mtx_unlock(mp);
 
 	sleepq_add(cvp, mp, cvp->cv_description, SLEEPQ_CONDVAR |
-	    SLEEPQ_INTERRUPTIBLE);
+	    SLEEPQ_INTERRUPTIBLE, SQ_EXCLUSIVE_LOCK);
 	sleepq_set_timeout(cvp, timo);
 	rval = sleepq_timedwait_sig(cvp);
 
@@ -337,7 +339,7 @@
 	sleepq_lock(cvp);
 	if (cvp->cv_waiters > 0) {
 		cvp->cv_waiters--;
-		sleepq_signal(cvp, SLEEPQ_CONDVAR, -1);
+		sleepq_signal(cvp, SLEEPQ_CONDVAR, -1, SQ_EXCLUSIVE_LOCK);
 	} else
 		sleepq_release(cvp);
 }
@@ -353,7 +355,7 @@
 	sleepq_lock(cvp);
 	if (cvp->cv_waiters > 0) {
 		cvp->cv_waiters = 0;
-		sleepq_broadcast(cvp, SLEEPQ_CONDVAR, pri);
+		sleepq_broadcast(cvp, SLEEPQ_CONDVAR, pri, SQ_EXCLUSIVE_LOCK);
 	} else
 		sleepq_release(cvp);
 }
==== //depot/vendor/freebsd/src/sys/kern/kern_synch.c#132 (text+ko) - //depot/user/attilio/attilio_smpng/kern/kern_synch.c#2 (text+ko) ==== content
@@ -188,7 +188,7 @@
 	 * stopped, then td will no longer be on a sleep queue upon
 	 * return from cursig().
 	 */
-	sleepq_add(ident, mtx, wmesg, flags);
+	sleepq_add(ident, mtx, wmesg, flags, SQ_EXCLUSIVE_LOCK);
 	if (timo)
 		sleepq_set_timeout(ident, timo);
 
@@ -265,7 +265,7 @@
 	/*
 	 * We put ourselves on the sleep queue and start our timeout.
 	 */
-	sleepq_add(ident, mtx, wmesg, SLEEPQ_MSLEEP);
+	sleepq_add(ident, mtx, wmesg, SLEEPQ_MSLEEP, SQ_EXCLUSIVE_LOCK);
 	if (timo)
 		sleepq_set_timeout(ident, timo);
 
@@ -314,7 +314,7 @@
 {
 
 	sleepq_lock(ident);
-	sleepq_broadcast(ident, SLEEPQ_MSLEEP, -1);
+	sleepq_broadcast(ident, SLEEPQ_MSLEEP, -1, SQ_EXCLUSIVE_LOCK);
 }
 
 /*
@@ -328,7 +328,7 @@
 {
 
 	sleepq_lock(ident);
-	sleepq_signal(ident, SLEEPQ_MSLEEP, -1);
+	sleepq_signal(ident, SLEEPQ_MSLEEP, -1, SQ_EXCLUSIVE_LOCK);
 }
 
 /*
==== //depot/vendor/freebsd/src/sys/kern/subr_sleepqueue.c#29 (text+ko) - //depot/user/attilio/attilio_smpng/kern/subr_sleepqueue.c#5 (text+ko) ==== content
@@ -54,9 +54,7 @@
  * mix the sleep/wakeup and cv APIs for a given wait channel.  Also, one
  * must consistently use the same lock to synchronize with a wait channel,
  * though this check is currently only a warning for sleep/wakeup due to
- * pre-existing abuse of that API.  The same lock must also be held when
- * awakening threads, though that is currently only enforced for condition
- * variables.
+ * pre-existing abuse of that API.
  */
 
 #include <sys/cdefs.h>
@@ -70,7 +68,6 @@
 #include <sys/lock.h>
 #include <sys/kernel.h>
 #include <sys/ktr.h>
-#include <sys/malloc.h>
 #include <sys/mutex.h>
 #include <sys/proc.h>
 #include <sys/sched.h>
@@ -78,6 +75,8 @@
 #include <sys/sleepqueue.h>
 #include <sys/sysctl.h>
 
+#include <vm/uma.h>
+
 #ifdef DDB
 #include <ddb/ddb.h>
 #endif
@@ -96,6 +95,13 @@
 #define	SC_LOOKUP(wc)	&sleepq_chains[SC_HASH(wc)]
 
 /*
+ * Set the default item cache alignment if not specified otherwise.
+ */
+#ifndef	SYNC_ALIGN
+#define	SYNC_ALIGN	UMA_ALIGN_CACHE
+#endif
+
+/*
  * There two different lists of sleep queues.  Both lists are connected
  * via the sq_hash entries.  The first list is the sleep queue chain list
  * that a sleep queue is on when it is attached to a wait channel.  The
@@ -114,7 +120,7 @@
  *  c - sleep queue chain lock
  */
 struct sleepqueue {
-	TAILQ_HEAD(, thread) sq_blocked;	/* (c) Blocked threads. */
+	TAILQ_HEAD(, thread) sq_blocked[2];	/* (c) Blocked threads. */
 	LIST_ENTRY(sleepqueue) sq_hash;		/* (c) Chain and free list. */
 	LIST_HEAD(, sleepqueue) sq_free;	/* (c) Free queues. */
 	void	*sq_wchan;			/* (c) Wait channel. */
@@ -142,16 +148,20 @@
     0, "maxmimum depth achieved of a single chain");
 #endif
 static struct sleepqueue_chain sleepq_chains[SC_TABLESIZE];
-
-static MALLOC_DEFINE(M_SLEEPQUEUE, "sleepqueue", "sleep queues");
+static uma_zone_t sleepq_zone;
 
 /*
  * Prototypes for non-exported routines.
  */
+static int	sleepq_catch_signals(void *wchan);
+static int	sleepq_check_signals(void);
 static int	sleepq_check_timeout(void);
+static void	sleepq_fini(void *mem, int size);
+static int	sleepq_init(void *mem, int size, int flags);
+static void	sleepq_resume_thread(struct sleepqueue *sq, struct thread *td,
+		    int pri);
 static void	sleepq_switch(void *wchan);
 static void	sleepq_timeout(void *arg);
-static void	sleepq_resume_thread(struct sleepqueue *sq, struct thread *td, int pri);
 
 /*
  * Early initialization of sleep queues that is called from the sleepinit()
@@ -182,21 +192,19 @@
 		    NULL);
 #endif
 	}
+	sleepq_zone = uma_zcreate("SLEEPQUEUE", sizeof(struct sleepqueue),
+	    NULL, NULL, sleepq_init, sleepq_fini, SYNC_ALIGN, 0);
 	thread0.td_sleepqueue = sleepq_alloc();
 }
 
 /*
- * Malloc and initialize a new sleep queue for a new thread.
+ * Get a sleep queue for a new thread.
  */
 struct sleepqueue *
 sleepq_alloc(void)
 {
-	struct sleepqueue *sq;
 
-	sq = malloc(sizeof(struct sleepqueue), M_SLEEPQUEUE, M_WAITOK | M_ZERO);
-	TAILQ_INIT(&sq->sq_blocked);
-	LIST_INIT(&sq->sq_free);
-	return (sq);
+	return (uma_zalloc(sleepq_zone, M_WAITOK));
 }
 
 /*
@@ -206,9 +214,7 @@
 sleepq_free(struct sleepqueue *sq)
 {
 
-	MPASS(sq != NULL);
-	MPASS(TAILQ_EMPTY(&sq->sq_blocked));
-	free(sq, M_SLEEPQUEUE);
+	uma_zfree(sleepq_zone, sq);
 }
 
 /*
@@ -262,7 +268,8 @@
  * woken up.
  */
 void
-sleepq_add(void *wchan, struct mtx *lock, const char *wmesg, int flags)
+sleepq_add(void *wchan, struct mtx *lock, const char *wmesg, int flags,
+    int queue)
 {
 	struct sleepqueue_chain *sc;
 	struct sleepqueue *sq;
@@ -273,6 +280,7 @@
 	mtx_assert(&sc->sc_lock, MA_OWNED);
 	MPASS(td->td_sleepqueue != NULL);
 	MPASS(wchan != NULL);
+	MPASS(queue == SQ_EXCLUSIVE_QUEUE || queue == SQ_SHARED_QUEUE);
 
 	/* If this thread is not allowed to sleep, die a horrible death. */
 	KASSERT(!(td->td_pflags & TDP_NOSLEEPING),
@@ -297,8 +305,10 @@
 #endif
 		sq = td->td_sleepqueue;
 		LIST_INSERT_HEAD(&sc->sc_queues, sq, sq_hash);
-		KASSERT(TAILQ_EMPTY(&sq->sq_blocked),
-		    ("thread's sleep queue has a non-empty queue"));
+		KASSERT(TAILQ_EMPTY(&sq->sq_blocked[SQ_EXCLUSIVE_QUEUE]),
+		    ("thread's sleep queue has an exclusive non-empty queue"));
+		KASSERT(TAILQ_EMPTY(&sq->sq_blocked[SQ_SHARED_QUEUE]),
+		    ("thread's sleep queue has a shared non-empty queue"));
 		KASSERT(LIST_EMPTY(&sq->sq_free),
 		    ("thread's sleep queue has a non-empty free list"));
 		KASSERT(sq->sq_wchan == NULL, ("stale sq_wchan pointer"));
@@ -313,9 +323,10 @@
 		MPASS((flags & SLEEPQ_TYPE) == sq->sq_type);
 		LIST_INSERT_HEAD(&sq->sq_free, td->td_sleepqueue, sq_hash);
 	}
-	TAILQ_INSERT_TAIL(&sq->sq_blocked, td, td_slpq);
+	TAILQ_INSERT_TAIL(&sq->sq_blocked[queue], td, td_slpq);
 	td->td_sleepqueue = NULL;
 	mtx_lock_spin(&sched_lock);
+	td->td_sqqueue = queue;
 	td->td_wchan = wchan;
 	td->td_wmesg = wmesg;
 	if (flags & SLEEPQ_INTERRUPTIBLE) {
@@ -606,12 +617,14 @@
 	MPASS(td != NULL);
 	MPASS(sq->sq_wchan != NULL);
 	MPASS(td->td_wchan == sq->sq_wchan);
+	MPASS(td->td_sqqueue == SQ_EXCLUSIVE_QUEUE || td->td_sqqueue ==
+	    SQ_SHARED_QUEUE);
 	sc = SC_LOOKUP(sq->sq_wchan);
 	mtx_assert(&sc->sc_lock, MA_OWNED);
 	mtx_assert(&sched_lock, MA_OWNED);
 
 	/* Remove the thread from the queue. */
-	TAILQ_REMOVE(&sq->sq_blocked, td, td_slpq);
+	TAILQ_REMOVE(&sq->sq_blocked[td->td_sqqueue], td, td_slpq);
 
 	/*
 	 * Get a sleep queue for this thread.  If this is the last waiter,
@@ -653,16 +666,46 @@
 }
 
 /*
+ * UMA zone item deallocator.
+ */
+static void
+sleepq_fini(void *mem, int size)
+{
+	struct sleepqueue *sq;
+
+	sq = mem;
+	MPASS(TAILQ_EMPTY(&sq->sq_blocked[SQ_EXCLUSIVE_QUEUE]));
+	MPASS(TAILQ_EMPTY(&sq->sq_blocked[SQ_SHARED_QUEUE]));
+}
+
+/*
+ * UMA zone item initializer.
+ */
+static int
+sleepq_init(void *mem, int size, int flags)
+{
+	struct sleepqueue *sq;
+
+	bzero(mem, size);
+	sq = mem;
+	TAILQ_INIT(&sq->sq_blocked[SQ_EXCLUSIVE_QUEUE]);
+	TAILQ_INIT(&sq->sq_blocked[SQ_SHARED_QUEUE]);
+	LIST_INIT(&sq->sq_free);
+	return (0);
+}
+
+/*
  * Find the highest priority thread sleeping on a wait channel and resume it.
  */
 void
-sleepq_signal(void *wchan, int flags, int pri)
+sleepq_signal(void *wchan, int flags, int pri, int queue)
 {
 	struct sleepqueue *sq;
 	struct thread *td, *besttd;
 
 	CTR2(KTR_PROC, "sleepq_signal(%p, %d)", wchan, flags);
 	KASSERT(wchan != NULL, ("%s: invalid NULL wait channel", __func__));
+	MPASS(queue == SQ_EXCLUSIVE_QUEUE || queue == SQ_SHARED_QUEUE);
 	sq = sleepq_lookup(wchan);
 	if (sq == NULL) {
 		sleepq_release(wchan);
@@ -678,7 +721,7 @@
 	 * the tail of sleep queues.
 	 */
 	besttd = NULL;
-	TAILQ_FOREACH(td, &sq->sq_blocked, td_slpq) {
+	TAILQ_FOREACH(td, &sq->sq_blocked[queue], td_slpq) {
 		if (besttd == NULL || td->td_priority < besttd->td_priority)
 			besttd = td;
 	}
@@ -693,12 +736,13 @@
  * Resume all threads sleeping on a specified wait channel.
  */
 void
-sleepq_broadcast(void *wchan, int flags, int pri)
+sleepq_broadcast(void *wchan, int flags, int pri, int queue)
 {
 	struct sleepqueue *sq;
 
 	CTR2(KTR_PROC, "sleepq_broadcast(%p, %d)", wchan, flags);
 	KASSERT(wchan != NULL, ("%s: invalid NULL wait channel", __func__));
+	MPASS(queue == SQ_EXCLUSIVE_QUEUE || queue == SQ_SHARED_QUEUE);
 	sq = sleepq_lookup(wchan);
 	if (sq == NULL) {
 		sleepq_release(wchan);
@@ -709,8 +753,9 @@
 
 	/* Resume all blocked threads on the sleep queue. */
 	mtx_lock_spin(&sched_lock);
-	while (!TAILQ_EMPTY(&sq->sq_blocked))
-		sleepq_resume_thread(sq, TAILQ_FIRST(&sq->sq_blocked), pri);
+	while (!TAILQ_EMPTY(&sq->sq_blocked[queue]))
+		sleepq_resume_thread(sq, TAILQ_FIRST(&sq->sq_blocked[queue]),
+		    pri);
 	mtx_unlock_spin(&sched_lock);
 	sleepq_release(wchan);
 }
@@ -901,15 +946,27 @@
 	}
 #endif
 	db_printf("Blocked threads:\n");
-	if (TAILQ_EMPTY(&sq->sq_blocked))
+	db_printf("\nExclusive queue:\n");
+	if (TAILQ_EMPTY(&sq->sq_blocked[SQ_EXCLUSIVE_QUEUE]))
+		db_printf("\tempty\n");
+	else
+		TAILQ_FOREACH(td, &sq->sq_blocked[SQ_EXCLUSIVE_QUEUE],
+		    td_slpq) {
+			db_printf("\t%p (tid %d, pid %d, \"%s\")\n", td,
+			    td->td_tid, td->td_proc->p_pid,
+			    td->td_name[0] != '\0' ? td->td_name :
+			    td->td_proc->p_comm);
+		}
+	db_printf("\nShared queue:\n");
+	if (TAILQ_EMPTY(&sq->sq_blocked[SQ_SHARED_QUEUE]))
 		db_printf("\tempty\n");
 	else
-		TAILQ_FOREACH(td, &sq->sq_blocked, td_slpq) {
+		TAILQ_FOREACH(td, &sq->sq_blocked[SQ_SHARED_QUEUE], td_slpq) {
 			db_printf("\t%p (tid %d, pid %d, \"%s\")\n", td,
 			    td->td_tid, td->td_proc->p_pid,
 			    td->td_name[0] != '\0' ? td->td_name :
 			    td->td_proc->p_comm);
-		}	
+		}
 }
 
 /* Alias 'show sleepqueue' to 'show sleepq'. */
==== //depot/vendor/freebsd/src/sys/kern/subr_turnstile.c#31 (text+ko) - //depot/user/attilio/attilio_smpng/kern/subr_turnstile.c#2 (text+ko) ==== content
@@ -46,14 +46,14 @@
  * chain.  Each chain contains a spin mutex that protects all of the
  * turnstiles in the chain.
  *
- * Each time a thread is created, a turnstile is malloc'd and attached to
- * that thread.  When a thread blocks on a lock, if it is the first thread
- * to block, it lends its turnstile to the lock.  If the lock already has
- * a turnstile, then it gives its turnstile to the lock's turnstile's free
- * list.  When a thread is woken up, it takes a turnstile from the free list
- * if there are any other waiters.  If it is the only thread blocked on the
- * lock, then it reclaims the turnstile associated with the lock and removes
- * it from the hash table.
+ * Each time a thread is created, a turnstile is got from a specific UMA zone
+ * and attached to that thread.  When a thread blocks on a lock, if it is the
+ * first thread to block, it lends its turnstile to the lock.  If the lock
+ * already has a turnstile, then it gives its turnstile to the lock's
+ * turnstile's free list.  When a thread is woken up, it takes a turnstile from
+ * the free list if there are any other waiters.  If it is the only thread
+ * blocked on the lock, then it reclaims the turnstile associated with the lock
+ * and removes it from the hash table.
  */
 
 #include <sys/cdefs.h>
@@ -67,7 +67,6 @@
 #include <sys/kernel.h>
 #include <sys/ktr.h>
 #include <sys/lock.h>
-#include <sys/malloc.h>
 #include <sys/mutex.h>
 #include <sys/proc.h>
 #include <sys/queue.h>
@@ -75,6 +74,8 @@
 #include <sys/sysctl.h>
 #include <sys/turnstile.h>
 
+#include <vm/uma.h>
+
 #ifdef DDB
 #include <sys/kdb.h>
 #include <ddb/ddb.h>
@@ -95,6 +96,13 @@
 #define	TC_LOOKUP(lock)	&turnstile_chains[TC_HASH(lock)]
 
 /*
+ * Set the default item cache alignment if not specified otherwise.
+ */
+#ifndef	SYNC_ALIGN
+#define	SYNC_ALIGN	UMA_ALIGN_CACHE
+#endif
+
+/*
  * There are three different lists of turnstiles as follows.  The list
  * connected by ts_link entries is a per-thread list of all the turnstiles
  * attached to locks that we own.  This is used to fixup our priority when
@@ -143,8 +151,7 @@
 #endif
 static struct mtx td_contested_lock;
 static struct turnstile_chain turnstile_chains[TC_TABLESIZE];
-
-static MALLOC_DEFINE(M_TURNSTILE, "turnstiles", "turnstiles");
+static uma_zone_t turnstile_zone;
 
 /*
  * Prototypes for non-exported routines.
@@ -158,6 +165,8 @@
 		    struct thread *td);
 static struct thread *turnstile_first_waiter(struct turnstile *ts);
 static void	turnstile_setowner(struct turnstile *ts, struct thread *owner);
+static void	turnstile_fini(void *mem, int size);
+static int	turnstile_init(void *mem, int size, int flags);
 
 /*
  * Walks the chain of turnstiles and their owners to propagate the priority
@@ -379,6 +388,8 @@
 init_turnstile0(void *dummy)
 {
 
+	turnstile_zone = uma_zcreate("TURNSTILE", sizeof(struct turnstile),
+	    NULL, NULL, turnstile_init, turnstile_fini, SYNC_ALIGN, 0);
 	thread0.td_turnstile = turnstile_alloc();
 }
 SYSINIT(turnstile0, SI_SUB_LOCK, SI_ORDER_ANY, init_turnstile0, NULL);
@@ -446,19 +457,44 @@
 }
 
 /*
- * Malloc a turnstile for a new thread, initialize it and return it.
+ * UMA zone item deallocator.
+ */
+static void
+turnstile_fini(void *mem, int size)
+{
+	struct turnstile *ts;
+
+	ts = mem;
+	MPASS(TAILQ_EMPTY(&ts->ts_blocked[TS_EXCLUSIVE_QUEUE]));
+	MPASS(TAILQ_EMPTY(&ts->ts_blocked[TS_SHARED_QUEUE]));
+	MPASS(TAILQ_EMPTY(&ts->ts_pending));
+}
+
+/*
+ * UMA zone item initializer.
  */
-struct turnstile *
-turnstile_alloc(void)
+static int
+turnstile_init(void *mem, int size, int flags)
 {
 	struct turnstile *ts;
 
-	ts = malloc(sizeof(struct turnstile), M_TURNSTILE, M_WAITOK | M_ZERO);
+	bzero(mem, size);
+	ts = mem;
 	TAILQ_INIT(&ts->ts_blocked[TS_EXCLUSIVE_QUEUE]);
 	TAILQ_INIT(&ts->ts_blocked[TS_SHARED_QUEUE]);
 	TAILQ_INIT(&ts->ts_pending);
 	LIST_INIT(&ts->ts_free);
-	return (ts);
+	return (0);
+}
+
+/*
+ * Get a turnstile for a new thread.
+ */
+struct turnstile *
+turnstile_alloc(void)
+{
+
+	return (uma_zalloc(turnstile_zone, M_WAITOK));
 }
 
 /*
@@ -468,11 +504,7 @@
 turnstile_free(struct turnstile *ts)
 {
 
-	MPASS(ts != NULL);
-	MPASS(TAILQ_EMPTY(&ts->ts_blocked[TS_EXCLUSIVE_QUEUE]));
-	MPASS(TAILQ_EMPTY(&ts->ts_blocked[TS_SHARED_QUEUE]));
-	MPASS(TAILQ_EMPTY(&ts->ts_pending));
-	free(ts, M_TURNSTILE);
+	uma_zfree(turnstile_zone, ts);
 }
 
 /*
==== //depot/vendor/freebsd/src/sys/sys/proc.h#288 (text+ko) - //depot/user/attilio/attilio_smpng/sys/proc.h#3 (text+ko) ==== content
@@ -265,6 +265,7 @@
 	int		td_inhibitors;	/* (j) Why can not run. */
 	int		td_pflags;	/* (k) Private thread (TDP_*) flags. */
 	int		td_dupfd;	/* (k) Ret value from fdopen. XXX */
+	int		td_sqqueue;	/* (j) Sleep queue blocked on. */
 	void		*td_wchan;	/* (j) Sleep address. */
 	const char	*td_wmesg;	/* (j) Reason for sleep. */
 	u_char		td_lastcpu;	/* (j) Last cpu we were on. */
==== //depot/vendor/freebsd/src/sys/sys/sleepqueue.h#7 (text+ko) - //depot/user/attilio/attilio_smpng/sys/sleepqueue.h#5 (text+ko) ==== content
@@ -33,8 +33,8 @@
 #define _SYS_SLEEPQUEUE_H_
 
 /*
- * Sleep queue interface.  Sleep/wakeup and condition variables use a sleep
- * queue for the queue of threads blocked on a sleep channel.
+ * Sleep queue interface.  Sleep/wakeup, condition variables and sx locks
+ * use a sleep queue for the queue of threads blocked on a sleep channel.
  *
  * A thread calls sleepq_lock() to lock the sleep queue chain associated
  * with a given wait channel.  A thread can then call call sleepq_add() to
@@ -84,23 +84,32 @@
 #define	SLEEPQ_TYPE		0x0ff		/* Mask of sleep queue types. */
 #define	SLEEPQ_MSLEEP		0x00		/* Used by msleep/wakeup. */
 #define	SLEEPQ_CONDVAR		0x01		/* Used for a cv. */
+#define	SLEEPQ_SX		0x02		/* Used for a sx lock. */
 #define	SLEEPQ_INTERRUPTIBLE	0x100		/* Sleep is interruptible. */
 
+/* Handy sleep queues delivery constants. */
+#define	SQ_EXCLUSIVE_QUEUE	0
+#define	SQ_SHARED_QUEUE		1
+
+#define	SQ_EXCLUSIVE_LOCK	SQ_EXCLUSIVE_QUEUE
+#define	SQ_SHARED_LOCK		SQ_SHARED_QUEUE
+
 void	init_sleepqueues(void);
 void	sleepq_abort(struct thread *td, int intrval);
-void	sleepq_add(void *, struct mtx *, const char *, int);
+void	sleepq_add(void *wchan, struct mtx *lock, const char *wmesg, int flags,
+	    int queue);
 struct sleepqueue *sleepq_alloc(void);
-void	sleepq_broadcast(void *, int, int);
-void	sleepq_free(struct sleepqueue *);
-void	sleepq_lock(void *);
-struct sleepqueue *sleepq_lookup(void *);
-void	sleepq_release(void *);
-void	sleepq_remove(struct thread *, void *);
-void	sleepq_signal(void *, int, int);
+void	sleepq_broadcast(void *wchan, int flags, int pri, int queue);
+void	sleepq_free(struct sleepqueue *sq);
+void	sleepq_lock(void *wchan);
+struct sleepqueue *sleepq_lookup(void *wchan);
+void	sleepq_release(void *wchan);
+void	sleepq_remove(struct thread *td, void *wchan);
+void	sleepq_signal(void *wchan, int flags, int pri, int queue);
 void	sleepq_set_timeout(void *wchan, int timo);
 int	sleepq_timedwait(void *wchan);
 int	sleepq_timedwait_sig(void *wchan);
-void	sleepq_wait(void *);
+void	sleepq_wait(void *wchan);
 int	sleepq_wait_sig(void *wchan);
 
 #endif	/* _KERNEL */
==== //depot/vendor/freebsd/src/sys/i386/include/param.h#23 (text+ko) - //depot/user/attilio/attilio_smpng/i386/include/param.h#2 (text+ko) ==== content
@@ -109,6 +109,15 @@
 #endif
 
 /*
+ * Define our own cache alignment mask for syncronizing primitives.  Pentium4
+ * and Xeon want a 128-byte wide aligned syncronizing primitive in order to
+ * minimize cache bus traffic on CPUs cache lines movements.
+ */
+#ifndef	SYNC_ALIGN
+#define	SYNC_ALIGN	(128 - 1)
+#endif
+
+/*
  * Ceiling on size of buffer cache (really only effects write queueing,
  * the VM page cache is not effected), can be changed via
  * the kern.maxbcache /boot/loader.conf variable.
