kernel - Fix memory leak, clean up kernel slab fragmentation
authorMatthew Dillon <dillon@apollo.backplane.com>
Thu, 7 Nov 2013 19:21:12 +0000 (11:21 -0800)
committerMatthew Dillon <dillon@apollo.backplane.com>
Fri, 8 Nov 2013 07:29:06 +0000 (23:29 -0800)
commit21c324a6889464ae924865c96c2cefe057b6bf07
tree044dd7b1bb1aa4084df654830dc33a832b5c8eaf
parent00b0e039656a19ae9b6e013c90d49904f322301e
kernel - Fix memory leak, clean up kernel slab fragmentation

* The kernel slab allocator collects off-cpu kfree()s in z_RChunks.  This
  linked list is freed up by the owning cpu.  However, zones which are not
  at the head of the list can wind up with non-NULL z_RChunks which never
  get freed.

* Add a 10-second callout on every cpu to clean-up these stale zones, giving
  the kernel a chance to free the related zones.

* This was probably the cause for other kernel memory leaks reported in the
  past.

Found-by: sephe
sys/kern/kern_slaballoc.c
sys/kern/kern_timeout.c
sys/sys/malloc.h