kernel - Fix resident_count problems with kernel_pmap & related crashes
authorMatthew Dillon <dillon@apollo.backplane.com>
Fri, 30 Apr 2010 02:48:58 +0000 (19:48 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Fri, 30 Apr 2010 02:48:58 +0000 (19:48 -0700)
commit45758e38420d8432ef186f03c126262d4becd1af
tree2fcc9b4da174b5627457c635ea364ecba1e20cc1
parentc1f3c069126d3e79e6acbc44e67090de3376f8f3
kernel - Fix resident_count problems with kernel_pmap & related crashes

* kernel_pmap.pm_stats.resident_count could get out of sync due to the
  lwbuf code calling kmem_free() on KVM with pages that were entered
  via pmap_kenter().  Delete the pages before calling kmem_free().

  This in turn caused various failures and kernel panics due to conditionals
  based on resident_count == 0.  Heavy sendfile() activity could trigger
  the bug but it was taking a few days for the resident_count to decrement
  to zero.

* Fix a similar issue in zdestroy() on ZONE_INTERRUPT zones.  Nothing calls
  this routine so it was not a vector for crashes.

* Document the case.
sys/cpu/i386/misc/lwbuf.c
sys/vm/vm_kern.c
sys/vm/vm_zone.c