Skip to content

Commit f521ce1

Browse files
Prakash Suryabehlendorf
authored andcommitted
Allow "arc_p" to drop to zero or grow to "arc_c"
Setting a limit on the minimum value of "arc_p" has been shown to have detrimental effects on the arc hit rate for certain "metadata" intensive workloads. Specifically, this has been exhibited with a workload that constantly dirties new "metadata" but also frequently touches a "small" amount of mfu data (e.g. mkdir's). What is seen is that the new anon data throttles the mfu list to a negligible size (because arc_p > anon + mru in arc_get_data_buf), even though the mfu ghost list receives a constant stream of hits. To remedy this, arc_p is now allowed to drop to zero if the algorithm deems it necessary. Signed-off-by: Prakash Surya <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Issue #2110
1 parent 89c8cac commit f521ce1

File tree

2 files changed

+4
-24
lines changed

2 files changed

+4
-24
lines changed

man/man5/zfs-module-parameters.5

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -293,17 +293,6 @@ Min life of prefetch block
293293
Default value: \fB100\fR.
294294
.RE
295295

296-
.sp
297-
.ne 2
298-
.na
299-
\fBzfs_arc_p_min_shift\fR (int)
300-
.ad
301-
.RS 12n
302-
arc_c shift to calc min/max arc_p
303-
.sp
304-
Default value: \fB4\fR.
305-
.RE
306-
307296
.sp
308297
.ne 2
309298
.na

module/zfs/arc.c

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,6 @@ int arc_evict_iterations = 100;
172172
/* number of seconds before growing cache again */
173173
int zfs_arc_grow_retry = 5;
174174

175-
/* shift of arc_c for calculating both min and max arc_p */
176-
int zfs_arc_p_min_shift = 4;
177-
178175
/* disable anon data aggressively growing arc_p */
179176
int zfs_arc_p_aggressive_disable = 1;
180177

@@ -2335,7 +2332,6 @@ void
23352332
arc_shrink(uint64_t bytes)
23362333
{
23372334
if (arc_c > arc_c_min) {
2338-
uint64_t arc_p_min;
23392335
uint64_t to_free;
23402336

23412337
to_free = bytes ? bytes : arc_c >> zfs_arc_shrink_shift;
@@ -2345,13 +2341,12 @@ arc_shrink(uint64_t bytes)
23452341
else
23462342
arc_c = arc_c_min;
23472343

2348-
arc_p_min = (arc_c >> zfs_arc_p_min_shift);
23492344
to_free = bytes ? bytes : arc_p >> zfs_arc_shrink_shift;
23502345

2351-
if (arc_p > arc_p_min + to_free)
2346+
if (arc_p > to_free)
23522347
atomic_add_64(&arc_p, -to_free);
23532348
else
2354-
arc_p = arc_p_min;
2349+
arc_p = 0;
23552350

23562351
if (arc_c > arc_size)
23572352
arc_c = MAX(arc_size, arc_c_min);
@@ -2622,7 +2617,6 @@ static void
26222617
arc_adapt(int bytes, arc_state_t *state)
26232618
{
26242619
int mult;
2625-
uint64_t arc_p_min = (arc_c >> zfs_arc_p_min_shift);
26262620

26272621
if (state == arc_l2c_only)
26282622
return;
@@ -2641,7 +2635,7 @@ arc_adapt(int bytes, arc_state_t *state)
26412635
1 : (arc_mfu_ghost->arcs_size/arc_mru_ghost->arcs_size));
26422636
mult = MIN(mult, 10); /* avoid wild arc_p adjustment */
26432637

2644-
arc_p = MIN(arc_c - arc_p_min, arc_p + bytes * mult);
2638+
arc_p = MIN(arc_c, arc_p + bytes * mult);
26452639
} else if (state == arc_mfu_ghost) {
26462640
uint64_t delta;
26472641

@@ -2650,7 +2644,7 @@ arc_adapt(int bytes, arc_state_t *state)
26502644
mult = MIN(mult, 10);
26512645

26522646
delta = MIN(bytes * mult, arc_p);
2653-
arc_p = MAX(arc_p_min, arc_p - delta);
2647+
arc_p = MAX(0, arc_p - delta);
26542648
}
26552649
ASSERT((int64_t)arc_p >= 0);
26562650

@@ -5563,9 +5557,6 @@ MODULE_PARM_DESC(zfs_arc_p_aggressive_disable, "disable aggressive arc_p grow");
55635557
module_param(zfs_arc_shrink_shift, int, 0644);
55645558
MODULE_PARM_DESC(zfs_arc_shrink_shift, "log2(fraction of arc to reclaim)");
55655559

5566-
module_param(zfs_arc_p_min_shift, int, 0644);
5567-
MODULE_PARM_DESC(zfs_arc_p_min_shift, "arc_c shift to calc min/max arc_p");
5568-
55695560
module_param(zfs_disable_dup_eviction, int, 0644);
55705561
MODULE_PARM_DESC(zfs_disable_dup_eviction, "disable duplicate buffer eviction");
55715562

0 commit comments

Comments
 (0)