*** arc.c.noinitpatch Fri Sep 12 17:59:08 2014 --- arc.c Fri Sep 12 23:49:43 2014 *************** *** 212,218 **** arc_free_target_init(void *unused __unused) { ! zfs_arc_free_target = (vm_pageout_wakeup_thresh / 2) * 3; } SYSINIT(arc_free_target_init, SI_SUB_KTHREAD_PAGE, SI_ORDER_ANY, arc_free_target_init, NULL); --- 212,218 ---- arc_free_target_init(void *unused __unused) { ! zfs_arc_free_target = cnt.v_free_target; } SYSINIT(arc_free_target_init, SI_SUB_KTHREAD_PAGE, SI_ORDER_ANY, arc_free_target_init, NULL); *************** *** 2511,2516 **** --- 2511,2532 ---- u_int fm; #ifdef _KERNEL + + /* + * First check to see if dirty_data_max needs adjusting. Do not allow + * the dirty data amount per pool to exceed free, non-swappable RAM. + * Subject this to the original test of the max_max limit and a minimum + * of 512KB. + */ + zfs_dirty_data_max = ptob(cnt.v_free_count) - ptob(cnt.v_free_min); + if (zfs_dirty_data_max <= 1 << 24) { + zfs_dirty_data_max = 1 << 24; + } + zfs_dirty_data_max = MIN(zfs_dirty_data_max, ptob(physmem) * + zfs_dirty_data_max_percent / 100); + zfs_dirty_data_max = MIN(zfs_dirty_data_max, zfs_dirty_data_max_max); + + if (arc_size <= arc_c_min) { DTRACE_PROBE2(arc__reclaim_min, uint64_t, arc_size, uint64_t, arc_c_min);