Skip to content

Commit 84ea099

Browse files
amotinjsai20
authored andcommitted
Fix dmu_tx_dirty_throttle after arc_c reduction
After initial arc_c was reduced to arc_c_min it became possible that on datasets with primarycache=metadata or none dirty data make up most of ARC capacity and easily more than configured 50% of initial arc_c, that causes forced txg commits by arc_tempreserve_space() and periodic very long write delays. This patch makes arc_tempreserve_space() to use arc_c only after ARC warmed up once and arc_c really means something, but use arc_c_max before that. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Ryan Moeller <[email protected]> Reviewed-by: Matt Macy <[email protected]> Signed-off-by: Alexander Motin <[email protected]> Sponsored-By: iXsystems, Inc. Closes openzfs#11178
1 parent 2f1a2bb commit 84ea099

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

module/zfs/arc.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7212,19 +7212,19 @@ arc_tempreserve_space(spa_t *spa, uint64_t reserve, uint64_t txg)
72127212
*/
72137213
uint64_t total_dirty = reserve + arc_tempreserve + anon_size;
72147214
uint64_t spa_dirty_anon = spa_dirty_data(spa);
7215-
7216-
if (total_dirty > arc_c * zfs_arc_dirty_limit_percent / 100 &&
7217-
anon_size > arc_c * zfs_arc_anon_limit_percent / 100 &&
7215+
uint64_t rarc_c = arc_warm ? arc_c : arc_c_max;
7216+
if (total_dirty > rarc_c * zfs_arc_dirty_limit_percent / 100 &&
7217+
anon_size > rarc_c * zfs_arc_anon_limit_percent / 100 &&
72187218
spa_dirty_anon > anon_size * zfs_arc_pool_dirty_percent / 100) {
72197219
#ifdef ZFS_DEBUG
72207220
uint64_t meta_esize = zfs_refcount_count(
72217221
&arc_anon->arcs_esize[ARC_BUFC_METADATA]);
72227222
uint64_t data_esize =
72237223
zfs_refcount_count(&arc_anon->arcs_esize[ARC_BUFC_DATA]);
72247224
dprintf("failing, arc_tempreserve=%lluK anon_meta=%lluK "
7225-
"anon_data=%lluK tempreserve=%lluK arc_c=%lluK\n",
7225+
"anon_data=%lluK tempreserve=%lluK rarc_c=%lluK\n",
72267226
arc_tempreserve >> 10, meta_esize >> 10,
7227-
data_esize >> 10, reserve >> 10, arc_c >> 10);
7227+
data_esize >> 10, reserve >> 10, rarc_c >> 10);
72287228
#endif
72297229
DMU_TX_STAT_BUMP(dmu_tx_dirty_throttle);
72307230
return (SET_ERROR(ERESTART));

0 commit comments

Comments
 (0)