Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenZFS 9188 - increase size of dbuf cache to reduce indirect block decompression #7273

Merged
merged 1 commit into from
Mar 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions man/man5/zfs-module-parameters.5
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,57 @@ Description of the different parameters to the ZFS module.
.sp
.LP

.sp
.ne 2
.na
\fBdbuf_cache_max_bytes\fR (ulong)
.ad
.RS 12n
Maximum size in bytes of the dbuf cache. When \fB0\fR this value will default
to \fB1/2^dbuf_cache_shift\fR (1/32) of the target ARC size, otherwise the
provided value in bytes will be used. The behavior of the dbuf cache and its
associated settings can be observed via the \fB/proc/spl/kstat/zfs/dbufstats\fR
kstat.
.sp
Default value: \fB0\fR.
.RE

.sp
.ne 2
.na
\fBdbuf_cache_hiwater_pct\fR (uint)
.ad
.RS 12n
The percentage over \fBdbuf_cache_max_bytes\fR when dbufs must be evicted
directly.
.sp
Default value: \fB10\fR%.
.RE

.sp
.ne 2
.na
\fBdbuf_cache_lowater_pct\fR (uint)
.ad
.RS 12n
The percentage below \fBdbuf_cache_max_bytes\fR when the evict thread stops
evicting dbufs.
.sp
Default value: \fB10\fR%.
.RE

.sp
.ne 2
.na
\fBdbuf_cache_shift\fR (int)
.ad
.RS 12n
Set the size of the dbuf cache, \fBdbuf_cache_max_bytes\fR, to a log2 fraction
of the target arc size.
.sp
Default value: \fB5\fR.
.RE

.sp
.ne 2
.na
Expand Down
26 changes: 15 additions & 11 deletions module/zfs/dbuf.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,10 @@ static boolean_t dbuf_evict_thread_exit;
*/
static multilist_t *dbuf_cache;
static refcount_t dbuf_cache_size;
unsigned long dbuf_cache_max_bytes = 100 * 1024 * 1024;
unsigned long dbuf_cache_max_bytes = 0;

/* Cap the size of the dbuf cache to log2 fraction of arc size. */
int dbuf_cache_max_shift = 5;
/* Set the default size of the dbuf cache to log2 fraction of arc size. */
int dbuf_cache_shift = 5;

/*
* The dbuf cache uses a three-stage eviction policy:
Expand Down Expand Up @@ -561,7 +561,7 @@ static inline unsigned long
dbuf_cache_target_bytes(void)
{
return MIN(dbuf_cache_max_bytes,
arc_target_bytes() >> dbuf_cache_max_shift);
arc_target_bytes() >> dbuf_cache_shift);
}

static inline uint64_t
Expand Down Expand Up @@ -787,11 +787,15 @@ dbuf_init(void)
dbuf_stats_init(h);

/*
* Setup the parameters for the dbuf cache. We cap the size of the
* dbuf cache to 1/32nd (default) of the size of the ARC.
* Setup the parameters for the dbuf cache. We set the size of the
* dbuf cache to 1/32nd (default) of the target size of the ARC. If
* the value has been specified as a module option and it's not
* greater than the target size of the ARC, then we honor that value.
*/
dbuf_cache_max_bytes = MIN(dbuf_cache_max_bytes,
arc_target_bytes() >> dbuf_cache_max_shift);
if (dbuf_cache_max_bytes == 0 ||
dbuf_cache_max_bytes >= arc_target_bytes()) {
dbuf_cache_max_bytes = arc_target_bytes() >> dbuf_cache_shift;
}

/*
* All entries are queued via taskq_dispatch_ent(), so min/maxalloc
Expand Down Expand Up @@ -4216,8 +4220,8 @@ MODULE_PARM_DESC(dbuf_cache_lowater_pct,
"Percentage below dbuf_cache_max_bytes when the evict thread stops "
"evicting dbufs.");

module_param(dbuf_cache_max_shift, int, 0644);
MODULE_PARM_DESC(dbuf_cache_max_shift,
"Cap the size of the dbuf cache to a log2 fraction of arc size.");
module_param(dbuf_cache_shift, int, 0644);
MODULE_PARM_DESC(dbuf_cache_shift,
"Set the size of the dbuf cache to a log2 fraction of arc size.");
/* END CSTYLED */
#endif