Author: mjg
Date: Sun Oct 22 20:43:50 2017
New Revision: 324870
URL: https://svnweb.freebsd.org/changeset/base/324870

Log:
  Make the sleepq chain hash size configurable per-arch and bump on amd64.
  
  While here cache-align chains.
  
  This shortens longest found chain during poudriere -j 80 from 32 to 16.
  
  Pushing this higher up will probably require allocation on boot.

Modified:
  head/sys/amd64/include/param.h
  head/sys/kern/subr_sleepqueue.c

Modified: head/sys/amd64/include/param.h
==============================================================================
--- head/sys/amd64/include/param.h      Sun Oct 22 20:22:23 2017        
(r324869)
+++ head/sys/amd64/include/param.h      Sun Oct 22 20:43:50 2017        
(r324870)
@@ -152,4 +152,8 @@
 #define        INKERNEL(va) (((va) >= DMAP_MIN_ADDRESS && (va) < 
DMAP_MAX_ADDRESS) \
     || ((va) >= VM_MIN_KERNEL_ADDRESS && (va) < VM_MAX_KERNEL_ADDRESS))
 
+#ifdef SMP
+#define SC_TABLESIZE    1024                     /* Must be power of 2. */
+#endif
+
 #endif /* !_AMD64_INCLUDE_PARAM_H_ */

Modified: head/sys/kern/subr_sleepqueue.c
==============================================================================
--- head/sys/kern/subr_sleepqueue.c     Sun Oct 22 20:22:23 2017        
(r324869)
+++ head/sys/kern/subr_sleepqueue.c     Sun Oct 22 20:43:50 2017        
(r324870)
@@ -93,7 +93,10 @@ __FBSDID("$FreeBSD$");
  * Constants for the hash table of sleep queue chains.
  * SC_TABLESIZE must be a power of two for SC_MASK to work properly.
  */
-#define        SC_TABLESIZE    256                     /* Must be power of 2. 
*/
+#ifndef SC_TABLESIZE
+#define        SC_TABLESIZE    256
+#endif
+CTASSERT(powerof2(SC_TABLESIZE));
 #define        SC_MASK         (SC_TABLESIZE - 1)
 #define        SC_SHIFT        8
 #define        SC_HASH(wc)     ((((uintptr_t)(wc) >> SC_SHIFT) ^ 
(uintptr_t)(wc)) & \
@@ -137,7 +140,7 @@ struct sleepqueue_chain {
        u_int   sc_depth;                       /* Length of sc_queues. */
        u_int   sc_max_depth;                   /* Max length of sc_queues. */
 #endif
-};
+} __aligned(CACHE_LINE_SIZE);
 
 #ifdef SLEEPQUEUE_PROFILING
 u_int sleepq_max_depth;
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to