Fix abd leak, kmem_free correct size of abd_t
authorJorgen Lundman <lundman@lundman.net>
Thu, 1 Jul 2021 15:28:15 +0000 (00:28 +0900)
committerGitHub <noreply@github.com>
Thu, 1 Jul 2021 15:28:15 +0000 (09:28 -0600)
commitc6d1112bf4125e5a22eb47ceb7b8cee01f0df9a1
tree5ed4fbdfee28b0a46163a346d32a1984773eb31f
parenteca174527e0b8416550e6ce87c405702fd379ada
Fix abd leak, kmem_free correct size of abd_t

Fix a leak of abd_t that manifested mostly when using
raidzN with at least as many columns as N (e.g. a
four-disk raidz2 but not a three-disk raidz2).
Sufficiently heavy raidz use would eventually run a system
out of memory.

Additionally:

* Switch abd_cache arena to FIRSTFIT, which empirically
improves perofrmance.

* Make abd_chunk_cache more performant and debuggable.

* Allocate the abd_zero_buf from abd_chunk_cache rather
than the heap.

* Don't try to reap non-existent qcaches in abd_cache arena.

* KM_PUSHPAGE->KM_SLEEP when allocating chunks from their
own arena

Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Signed-off-by: Jorgen Lundman <lundman@lundman.net>
Co-authored-by: Sean Doran <smd@use.net>
Closes #12295
include/sys/abd_impl.h
module/os/freebsd/zfs/abd_os.c
module/os/linux/zfs/abd_os.c
module/zfs/abd.c