pipe - replace use of DELAY() with a better solution, add features.
authorMatthew Dillon <dillon@apollo.backplane.com>
Mon, 13 Jul 2009 05:14:43 +0000 (22:14 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Mon, 13 Jul 2009 05:14:43 +0000 (22:14 -0700)
commit880ffa3a9be14e3d9608214aabd8db2e5e9238ae
tree7eab2f0a5f50f4448150f148a4793240ac36730c
parentd2412a2eacb9f42231c72200f25bf9604ed6f470
pipe - replace use of DELAY() with a better solution, add features.

* Use the new tsc functions to poll for new read data in a pipe for a short
  period of time on a SMP box.  This greatly increases the odds of a pipe
  writer on one cpu being able to pipeline data to a reader on another cpu
  without having to use an IPI or tsleep/wakeup.

  For the pipe1 test this brings the synchronous communications path
  over a pipe (Awrite, Bread, Bwrite, Aread) down from 7uS to around 2uS.

  For the pipe2 test this value greatly reduces the number of IPIs
  and improves bandwidth by a few hundred megabytes/sec (the old DELAY
  did the same thing so there is no change for the pipe2 test).

* Add sysctl kern.pipe.delay which defaults to 5000 nanoseconds (5uS).
  This is the maximum a pipe reader will wait for additional data before
  falling back to tsleep/wakeup (and related ipis).  pipe_delay may be
  set to 0 to disable the function.  I value of at least 3000 is
  recomended.  Pipelining large buffers efficiently requires a higher value,
  say up to 8000 or so.

* Allow kern.pipe.mpsafe to be set to 2 which adds a predictive wakeup
  when a writer is found to be stalled.  This currently has no significant
  effect on operations due to token collisions.

* Add statistics: kern.pipe.wblocked and kern.pipe.rblocked, counting
  the number of times a pipe blocks in "pipewr" or "piperd".

* Fix MP races in pipe_ioctl().
sys/kern/sys_pipe.c