mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
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
This commit is contained in:
+17
-9
@@ -171,7 +171,6 @@ typedef struct dbuf_dirty_record {
|
||||
* gets COW'd in a subsequent transaction group.
|
||||
*/
|
||||
arc_buf_t *dr_data;
|
||||
blkptr_t dr_overridden_by;
|
||||
override_states_t dr_override_state;
|
||||
uint8_t dr_copies;
|
||||
boolean_t dr_nopwrite;
|
||||
@@ -179,14 +178,21 @@ typedef struct dbuf_dirty_record {
|
||||
boolean_t dr_diowrite;
|
||||
boolean_t dr_has_raw_params;
|
||||
|
||||
/*
|
||||
* If dr_has_raw_params is set, the following crypt
|
||||
* params will be set on the BP that's written.
|
||||
*/
|
||||
boolean_t dr_byteorder;
|
||||
uint8_t dr_salt[ZIO_DATA_SALT_LEN];
|
||||
uint8_t dr_iv[ZIO_DATA_IV_LEN];
|
||||
uint8_t dr_mac[ZIO_DATA_MAC_LEN];
|
||||
/* Override and raw params are mutually exclusive. */
|
||||
union {
|
||||
blkptr_t dr_overridden_by;
|
||||
struct {
|
||||
/*
|
||||
* If dr_has_raw_params is set, the
|
||||
* following crypt params will be set
|
||||
* on the BP that's written.
|
||||
*/
|
||||
boolean_t dr_byteorder;
|
||||
uint8_t dr_salt[ZIO_DATA_SALT_LEN];
|
||||
uint8_t dr_iv[ZIO_DATA_IV_LEN];
|
||||
uint8_t dr_mac[ZIO_DATA_MAC_LEN];
|
||||
};
|
||||
};
|
||||
} dl;
|
||||
struct dirty_lightweight_leaf {
|
||||
/*
|
||||
@@ -346,6 +352,8 @@ typedef struct dbuf_hash_table {
|
||||
|
||||
typedef void (*dbuf_prefetch_fn)(void *, uint64_t, uint64_t, boolean_t);
|
||||
|
||||
extern kmem_cache_t *dbuf_dirty_kmem_cache;
|
||||
|
||||
uint64_t dbuf_whichblock(const struct dnode *di, const int64_t level,
|
||||
const uint64_t offset);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user