kernel - Limit tags allocated to reads or writes for CAM/scsi/ahci disks
authorMatthew Dillon <dillon@apollo.backplane.com>
Sun, 10 Apr 2011 02:52:29 +0000 (19:52 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Sun, 10 Apr 2011 02:52:29 +0000 (19:52 -0700)
commitaf0aa0ac35206b1999465292512771001f1a1b37
tree70c7e798145093f16c06902f8b0dbffe50721796
parent8986d3514242e5247b08491c29d8792a6218c43f
kernel - Limit tags allocated to reads or writes for CAM/scsi/ahci disks

* Limit the number of tags which can be taken up read or write requests.
  If all tags are taken up by one type of request then the other type
  of request can become starved.

* This is particularly important because drives usually cache writes and
  return an immediate completion, so even if the system is reading heavily
  enough to eat a lot of tags we always want a few left in reserve to
  drain those writes in the drive's write cache.

* A similar situation can occur when flushing a lot of write data, which
  is almost guaranteed to fill up not only available tags but also the
  drive's write cache.  When the drive's write cache becomes full then
  write requests begin to stall (no longer return instantly), causing
  reads to become starved.

* When no tags are available give reads priority over writes for
  the moment.  This needs to be fixed.
sys/bus/cam/cam_queue.c
sys/bus/cam/cam_queue.h
sys/bus/cam/cam_sim.c
sys/bus/cam/cam_sim.h
sys/bus/cam/scsi/scsi_da.c