kernel - Fix MP system call performance regression
authorMatthew Dillon <dillon@apollo.backplane.com>
Fri, 10 Dec 2010 07:53:44 +0000 (23:53 -0800)
committerMatthew Dillon <dillon@apollo.backplane.com>
Fri, 10 Dec 2010 07:53:44 +0000 (23:53 -0800)
commit911d4144e391f5518957ca6012034414c8226203
treeaa7fefd48a17cea0c16575793891e855d6516353
parentb6bf0651b957674c38e6fb4157647be5a72e7074
kernel - Fix MP system call performance regression

* The userland scheduler was unconditionally calling lwkt_switch()
  via userexit() (i.e. on every system call), creating unnecessary
  overhead and possibly also triggering a bsd4 scheduler event
  requiring a common spinlock.

* Rearrange the code slightly to reduce instances where lwkt_switch()
  is called.  We want to try to keep instances where a higher priority
  LWKT thread is potentially runnable or when the LWKT fairq accumulator
  for the current thread has been exhausted.

* This removes system call overhead multiplication on MP systems.  For
  example, on a 48-core box system call overhead when all 48 cpus are
  busy doing getuid() loops went from 10uS back down to 270nS (which
  is near the single-cpu test results).
sys/kern/usched_bsd4.c