Reduce dirty records memory usage
commitb16e096198ba9e530c9fd3a955cde66b6a5efc8e
authorAlexander Motin <mav@FreeBSD.org>
Tue, 5 Nov 2024 00:42:06 +0000 (4 19:42 -0500)
committerGitHub <noreply@github.com>
Tue, 5 Nov 2024 00:42:06 +0000 (4 16:42 -0800)
tree88b80ce7db4da84868263362942cf6a0b4098a92
parent91bd12dfeb9abe432530615eaf2295d76da24b54
Reduce dirty records memory usage

Small block workloads may use a very large number of dirty records.
During simple block cloning test due to BRT still using 4KB blocks
I can easily see up to 2.5M of those used.  Before this change
dbuf_dirty_record_t structures representing them were allocated via
kmem_zalloc(), that rounded their size up to 512 bytes.

Introduction of specialized kmem cache allows to reduce the size
from 512 to 408 bytes.  Additionally, since override and raw params
in dirty records are mutually exclusive, puting them into a union
allows to reduce structure size down to 368 bytes, increasing the
saving to 28%, that can be a 0.5GB or more of RAM.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Brian Atkinson <batkinson@lanl.gov>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Sponsored by: iXsystems, Inc.
Closes #16694
include/sys/dbuf.h
module/zfs/dbuf.c
module/zfs/dmu.c
module/zfs/dmu_direct.c
module/zfs/dnode_sync.c