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>
Thu, 7 Nov 2013 19:30:23 +0000 (11:30 -0800)
commitc2f95d8a2185be01498f8b94a1cd429fbd520d45
tree3f5f7f1d821150668f07df7a22df3eccba895ecb
parent0238551e60e2dabcb1894e77d684ab0826501e58
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