diff options
author | mav <mav@FreeBSD.org> | 2013-03-12 06:58:49 +0000 |
---|---|---|
committer | mav <mav@FreeBSD.org> | 2013-03-12 06:58:49 +0000 |
commit | ca616198e5ffd9e04aa3190d1c3ff9b78383b083 (patch) | |
tree | 95fcd091ce327eb126b36b8374f04bc80e63216f /sys/kern/subr_sleepqueue.c | |
parent | 9b31bc755831124ab769b7338fe5d4d1e21f20bf (diff) | |
download | FreeBSD-src-ca616198e5ffd9e04aa3190d1c3ff9b78383b083.zip FreeBSD-src-ca616198e5ffd9e04aa3190d1c3ff9b78383b083.tar.gz |
Make kern_nanosleep() and pause_sbt() to use per-CPU sleep queues.
This removes significant sleep queue lock congestion on multithreaded
microbenchmarks, making them scale to multiple CPUs almost linearly.
Diffstat (limited to 'sys/kern/subr_sleepqueue.c')
-rw-r--r-- | sys/kern/subr_sleepqueue.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/sys/kern/subr_sleepqueue.c b/sys/kern/subr_sleepqueue.c index 3e1c0c3..1e1e263 100644 --- a/sys/kern/subr_sleepqueue.c +++ b/sys/kern/subr_sleepqueue.c @@ -88,16 +88,14 @@ __FBSDID("$FreeBSD$"); #endif /* - * Constants for the hash table of sleep queue chains. These constants are - * the same ones that 4BSD (and possibly earlier versions of BSD) used. - * Basically, we ignore the lower 8 bits of the address since most wait - * channel pointers are aligned and only look at the next 7 bits for the - * hash. SC_TABLESIZE must be a power of two for SC_MASK to work properly. + * 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 128 /* Must be power of 2. */ +#define SC_TABLESIZE 256 /* Must be power of 2. */ #define SC_MASK (SC_TABLESIZE - 1) #define SC_SHIFT 8 -#define SC_HASH(wc) (((uintptr_t)(wc) >> SC_SHIFT) & SC_MASK) +#define SC_HASH(wc) ((((uintptr_t)(wc) >> SC_SHIFT) ^ (uintptr_t)(wc)) & \ + SC_MASK) #define SC_LOOKUP(wc) &sleepq_chains[SC_HASH(wc)] #define NR_SLEEPQS 2 /* |