summaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authorTim Chase <[email protected]>2015-06-04 08:06:27 -0500
committerBrian Behlendorf <[email protected]>2015-06-11 10:27:25 -0700
commit121b3cae742a0670d902a51bc61d49dc4a3e4445 (patch)
tree346ad0f325b103b72ed7541fc0ce50511a1c0d34 /module
parentf6046738365571bd647f804958dfdff8a32fbde4 (diff)
Increase arc_c_min to allow safe operation of arc_adapt()
ZoL had lowered the minimum ARC size to 4MiB to better accommodate tiny systems such as the raspberry pi, however, as of addition of large block support, the arc_adapt() function depends on arc_c being >= 32MiB (2 * SPA_MAXBLOCKSIZE). This patch raises the minimum ARC size to 32MiB and adds a VERIFY test to arc_adapt() for future-proofing. Signed-off-by: Tim Chase <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]>
Diffstat (limited to 'module')
-rw-r--r--module/zfs/arc.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/module/zfs/arc.c b/module/zfs/arc.c
index 561c23124..805e7b59f 100644
--- a/module/zfs/arc.c
+++ b/module/zfs/arc.c
@@ -3088,8 +3088,8 @@ arc_adapt_thread(void)
zfs_arc_max != arc_c_max)
arc_c_max = zfs_arc_max;
- if (zfs_arc_min > 0 &&
- zfs_arc_min < arc_c_max &&
+ if (zfs_arc_min >= 2ULL << SPA_MAXBLOCKSHIFT &&
+ zfs_arc_min <= arc_c_max &&
zfs_arc_min != arc_c_min)
arc_c_min = zfs_arc_min;
@@ -3355,7 +3355,8 @@ arc_adapt(int bytes, arc_state_t *state)
* If we're within (2 * maxblocksize) bytes of the target
* cache size, increment the target cache size
*/
- if (arc_size > arc_c - (2ULL << SPA_MAXBLOCKSHIFT)) {
+ VERIFY3U(arc_c, >=, 2ULL << SPA_MAXBLOCKSHIFT);
+ if (arc_size >= arc_c - (2ULL << SPA_MAXBLOCKSHIFT)) {
atomic_add_64(&arc_c, (int64_t)bytes);
if (arc_c > arc_c_max)
arc_c = arc_c_max;
@@ -4826,8 +4827,8 @@ arc_init(void)
spl_register_shrinker(&arc_shrinker);
#endif
- /* set min cache to zero */
- arc_c_min = 4<<20;
+ /* set min cache to allow safe operation of arc_adapt() */
+ arc_c_min = 2ULL << SPA_MAXBLOCKSHIFT;
/* set max to 1/2 of all memory */
arc_c_max = arc_c * 4;
@@ -4837,7 +4838,8 @@ arc_init(void)
*/
if (zfs_arc_max > 64<<20 && zfs_arc_max < physmem * PAGESIZE)
arc_c_max = zfs_arc_max;
- if (zfs_arc_min > 0 && zfs_arc_min <= arc_c_max)
+ if (zfs_arc_min >= 2ULL << SPA_MAXBLOCKSHIFT &&
+ zfs_arc_min <= arc_c_max)
arc_c_min = zfs_arc_min;
arc_c = arc_c_max;