kernel - Fix latency issue with many cores contending on a token
authorMatthew Dillon <dillon@apollo.backplane.com>
Wed, 19 Oct 2011 04:06:49 +0000 (21:06 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Wed, 19 Oct 2011 04:06:49 +0000 (21:06 -0700)
commit7ab91d55c3e8140456098245bcbedc93a36e4e4b
tree5cc89e6938587d92c757eb6fa1dfd3c74a3ca480
parent492d98e6b3d974f37add30edccff2c7f0e05fae7
kernel - Fix latency issue with many cores contending on a token

* Fix a latency issue when many cores are contending on the same token.
  This can be tested e.g. by setting an interface to use polling mode
  and then pinging it from the outside.  Ping times in excess of 60 seconds
  (yes, seconds!) could occur.

* The problem turns out to be in usched_bsd4.c in the loop that tries to
  acquire the current process designation.  This loop runs in a critical
  section (and probably its caller too) and while it checks for the
  LWKT thread reschedule flag it fails to call splz() to process pending
  interrupts (like IPIs) that might SET the flag.

  Adding a single splz() prior to the lwkt reschedule check greatly
  reduces the latency problem.
sys/kern/usched_bsd4.c
sys/platform/pc64/x86_64/pmap.c