Skip to content

Commit 89c8cac

Browse files
Prakash Suryabehlendorf
authored andcommitted
Disable aggressive arc_p growth by default
For specific workloads consisting mainly of mfu data and new anon data buffers, the aggressive growth of arc_p found in the arc_get_data_buf() function can have detrimental effects on the mfu list size and ghost list hit rate. Running a workload consisting of two processes: * Process 1 is creating many small files * Process 2 is tar'ing a directory consisting of many small files I've seen arc_p and the mru grow to their maximum size, while the mru ghost list receives 100K times fewer hits than the mfu ghost list. Ideally, as the mfu ghost list receives hits, arc_p should be driven down and the size of the mfu should increase. Given the specific workload I was testing with, the mfu list size should grow to a point where almost no mfu ghost list hits would occur. Unfortunately, this does not happen because the newly dirtied anon buffers constancy drive arc_p to its maximum value and keep it there (effectively prioritizing the mru list and starving the mfu list down to a negligible size). The logic to increment arc_p from within the arc_get_data_buf() function was introduced many years ago in this upstream commit: commit 641fbdae3a027d12b3c3dcd18927ccafae6d58bc Author: maybee <none@none> Date: Wed Dec 20 15:46:12 2006 -0800 6505658 target MRU size (arc.p) needs to be adjusted more aggressively and since I don't fully understand the motivation for the change, I am reluctant to completely remove it. As a way to test out how it's removal might affect performance, I've disabled that code by default, but left it tunable via a module option. Thus, if its removal is found to be grossly detrimental for certain workloads, it can be re-enabled on the fly, without a code change. Signed-off-by: Prakash Surya <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Issue #2110
1 parent 39e055c commit 89c8cac

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

man/man5/zfs-module-parameters.5

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,17 @@ arc_c shift to calc min/max arc_p
304304
Default value: \fB4\fR.
305305
.RE
306306

307+
.sp
308+
.ne 2
309+
.na
310+
\fBzfs_arc_p_aggressive_disable\fR (int)
311+
.ad
312+
.RS 12n
313+
Disable aggressive arc_p growth
314+
.sp
315+
Use \fB1\fR for yes (default) and \fB0\fR to disable.
316+
.RE
317+
307318
.sp
308319
.ne 2
309320
.na

module/zfs/arc.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,9 @@ int zfs_arc_grow_retry = 5;
175175
/* shift of arc_c for calculating both min and max arc_p */
176176
int zfs_arc_p_min_shift = 4;
177177

178+
/* disable anon data aggressively growing arc_p */
179+
int zfs_arc_p_aggressive_disable = 1;
180+
178181
/* log2(fraction of arc to reclaim) */
179182
int zfs_arc_shrink_shift = 5;
180183

@@ -2798,7 +2801,8 @@ arc_get_data_buf(arc_buf_t *buf)
27982801
* If we are growing the cache, and we are adding anonymous
27992802
* data, and we have outgrown arc_p, update arc_p
28002803
*/
2801-
if (arc_size < arc_c && hdr->b_state == arc_anon &&
2804+
if (!zfs_arc_p_aggressive_disable &&
2805+
arc_size < arc_c && hdr->b_state == arc_anon &&
28022806
arc_anon->arcs_size + arc_mru->arcs_size > arc_p)
28032807
arc_p = MIN(arc_c, arc_p + size);
28042808
}
@@ -5553,6 +5557,9 @@ MODULE_PARM_DESC(zfs_arc_meta_prune, "Bytes of meta data to prune");
55535557
module_param(zfs_arc_grow_retry, int, 0644);
55545558
MODULE_PARM_DESC(zfs_arc_grow_retry, "Seconds before growing arc size");
55555559

5560+
module_param(zfs_arc_p_aggressive_disable, int, 0644);
5561+
MODULE_PARM_DESC(zfs_arc_p_aggressive_disable, "disable aggressive arc_p grow");
5562+
55565563
module_param(zfs_arc_shrink_shift, int, 0644);
55575564
MODULE_PARM_DESC(zfs_arc_shrink_shift, "log2(fraction of arc to reclaim)");
55585565

0 commit comments

Comments
 (0)