kernel - Fix a race and enable the VM read shortcut feature by default
authorMatthew Dillon <dillon@apollo.backplane.com>
Mon, 18 Feb 2013 20:08:29 +0000 (12:08 -0800)
committerMatthew Dillon <dillon@apollo.backplane.com>
Mon, 18 Feb 2013 20:08:29 +0000 (12:08 -0800)
commit74d299cb1b84453ab71490ab2c85e2dfec664a4b
treea05a653f5769828c56f38c6ce50f5f2cd8966de5
parent3b12ce4209b76362fc40be5b9071785823702a5a
kernel - Fix a race and enable the VM read shortcut feature by default

* Fix a lookup/access race.  No known cases hit the race but decided
  it needed to be fixed for safety.

  Instead of looking up and holding the VM page we know try to busy it,
  and only access the content if we are able to do so non-blocking.
  This costs a bit more in overhead but handles the page more properly.

  /usr/obj/usr/src
  time tar cf /dev/null .

  0.734u 5.781s 0:06.51 100.0%    24+66k 0+0io 0pf+0w (shorcut disabled)
  0.664u 2.382s 0:03.05 99.6%     24+66k 0+0io 0pf+0w (shorcut enabled)

* Default vm.read_shortcut_enable to 1.  The feature is now enabled by
  default.

* The feature has been in the tree a while default disabled and needs wider
  use, so it is being enabled by default.  The feature is only useful on
  64-bit systems (i.e. so the DMAP can be used).  It allows the buffer
  cache and the VM page mapping code to be completely bypassed in situations
  where the file data is available in the VM page cache.
sys/kern/vfs_helper.c