kernel - Implement a contiguous memory reserve for contigmalloc()
authorMatthew Dillon <dillon@apollo.backplane.com>
Sat, 19 Nov 2011 05:04:00 +0000 (21:04 -0800)
committerMatthew Dillon <dillon@apollo.backplane.com>
Sat, 19 Nov 2011 05:04:00 +0000 (21:04 -0800)
commit79d182b0d3dee841326d364c0e92e46c405765e6
tree651ec822770b6806960d3f2a9920fd9af2fa3a4d
parent7552e9eef6eb8f0961f48246048d0983de799206
kernel - Implement a contiguous memory reserve for contigmalloc()

* We initially reserve the lower 1/4 of memory or 256MB, whichever is
  smaller.  The ALIST API is used to manage the memory.

* Once device initialization is complete, and before int is executed,
  we reduce the reserve and return pages to the normal VM paging queues.
  The reserve is reduced to ~16MB or 1/16 total memory, whichever is
  smaller.

* This can be adjusted with a tunable 'vm.dma_reserved'.

* contigmalloc() now tries the DMA reserve first.  If it fails it falls
  back to the original contigmalloc() code.  contigfree() determines whether
  the pages belong to the DMA reserve or not and will either return them
  to the reserve or free them to the normal paging queues as appropriate.

  VM pages in the reserve are left wired and not busy, and they are returned
  to the reserve in the same state.  This greatly simplifies operations that
  act on the reserve.

* Fix various bits of code that contigmalloc()'d but then kfree()'d instead
  of contigfree()'d.
sys/dev/disk/ncr/ncr.c
sys/dev/raid/dpt/dpt_scsi.c
sys/platform/pc32/i386/machdep.c
sys/platform/pc64/x86_64/machdep.c
sys/sys/vmmeter.h
sys/vm/vm_contig.c
sys/vm/vm_extern.h
sys/vm/vm_page.c
sys/vm/vm_page.h