From bc07bf6206b7e6f96dcfc821f6c639a5e80b435a Mon Sep 17 00:00:00 2001 From: Fabian Keil Date: Tue, 26 Jan 2016 12:44:01 +0100 Subject: [PATCH 226/257] ZFS ARC: Remove the 'WAKE_PAGER' ... as I suspect that the "Don't do it if we woke the pager" code in arc_lowmem() increase the chances that the vm runs out of free pages. It's also not obvious (to me) that the WAKE_PAGER does anything useful. Quoting https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=187594#c244: "I have not yet tried Karl's latest patch but like to point out that some of the underlying assumptions about how the vm pager behaves seem incorrect to me. For example I'd expect calling pagedaemon_wakeup() without memory pressure (from the pagers point of view) to be pretty close to a nop as vm_pageout_worker() does its own checks before doing any heavy lifting: http://fxr.watson.org/fxr/source/vm/vm_pageout.c#L1634 Also note that vm_pageout_worker() is already called at least once per second anyway: [fk@polizei-erziehung ~]$ sudo /usr/src/share/dtrace/monitor-page-scanner 2015 Nov 1 17:20:45: Monitoring the page scanner. Minimum pass value to show 'boring' scans without memory pressure or inactive page surplus: 2 (Launder dirty pages). Press CTRL-C to abort. 2015 Nov 1 17:21:45: Scan goals in the previous minute: Update active LRU/deactivate pages 60 2015 Nov 1 17:22:45: Scan goals in the previous minute: Update active LRU/deactivate pages 60 I'm not claiming that increasing the frequency when there's no memory pressure causes any harm (besides code complexity), but I'm not convinced that it has the intended effect and needs to be triggered from ZFS (as opposed to changing the pager defaults)." Obtained from: ElectroBSD --- .../contrib/opensolaris/uts/common/fs/zfs/arc.c | 45 ---------------------- 1 file changed, 45 deletions(-) diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c index 5e80d2c93439..9c844e30e9e5 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c @@ -369,12 +369,6 @@ u_int zfs_arc_free_target = 0; u_int zfs_arc_wakeup_pager = 0; u_int zfs_arc_wakeup_delay = 500; -#define WAKE_PAGER -#ifdef WAKE_PAGER -#define WAKE_PAGER_CONSTANT 10 / 9 /* Pager wakeup threshold */ -static int arc_init_done = 0; /* We know arc_warm is valid */ -#endif /* WAKE_PAGER */ - /* Absolute min for arc min / max is 16MB. */ static uint64_t arc_abs_min = 16 << 20; @@ -391,9 +385,6 @@ arc_free_target_init(void *unused __unused) { zfs_arc_free_target = vm_pageout_wakeup_thresh + ((vm_cnt.v_free_target - vm_pageout_wakeup_thresh) / 2); -#ifdef WAKE_PAGER - zfs_arc_wakeup_pager = zfs_arc_free_target * WAKE_PAGER_CONSTANT; -#endif /* WAKE_PAGER */ } SYSINIT(arc_free_target_init, SI_SUB_KTHREAD_PAGE, SI_ORDER_ANY, arc_free_target_init, NULL); @@ -417,12 +408,6 @@ SYSCTL_INT(_vfs_zfs, OID_AUTO, compressed_arc_enabled, CTLFLAG_RDTUN, SYSCTL_INT(_vfs_zfs, OID_AUTO, dynamic_write_buffer, CTLFLAG_RWTUN, &zfs_dynamic_write_buffer, 0, "Dynamically restrict dirty data when memory is low"); -#ifdef WAKE_PAGER -SYSCTL_UINT(_vfs_zfs, OID_AUTO, arc_wakeup_pager, CTLFLAG_RWTUN, - &zfs_arc_wakeup_pager, 0, "Wake VM below this number of pages"); -SYSCTL_UINT(_vfs_zfs, OID_AUTO, arc_wakeup_delay, CTLFLAG_RWTUN, - &zfs_arc_wakeup_delay, 0, "May wake up VM once this number of MS"); -#endif /* WAKE_PAGER */ /* * We don't have a tunable for arc_free_target due to the dependency on @@ -450,9 +435,6 @@ sysctl_vfs_zfs_arc_free_target(SYSCTL_HANDLER_ARGS) return (EINVAL); zfs_arc_free_target = val; -#ifdef WAKE_PAGER - zfs_arc_wakeup_pager = zfs_arc_free_target * WAKE_PAGER_CONSTANT; -#endif /* WAKE_PAGER */ return (0); } @@ -3903,10 +3885,6 @@ arc_available_memory(void) free_memory_reason_t r = FMR_UNKNOWN; #ifdef _KERNEL -#ifdef WAKE_PAGER - sbintime_t now; - static sbintime_t last_pagedaemon_wake = 0; -#endif /* WAKE_PAGER */ if (needfree > 0) { n = PAGESIZE * (-needfree); if (n < lowest) { @@ -3925,26 +3903,6 @@ arc_available_memory(void) r = FMR_LOTSFREE; } -#ifdef WAKE_PAGER -/* - * If memory is less than the ARC wakeup threshold and time has expired since - * the last time we woke the pager... Do not execute until the ARC warms up. - */ - if ((arc_init_done) && - (((int64_t) freemem - zfs_arc_wakeup_pager) < 0) && - (arc_warm == B_TRUE) - ) { - now = getsbinuptime(); - if ((now - last_pagedaemon_wake) / SBT_1MS > zfs_arc_wakeup_delay) { - last_pagedaemon_wake = now; - arc_no_wake_event++; /* Set bypass flag for ARC */ - DTRACE_PROBE(arc__wake_pagedaemon); - pagedaemon_wakeup(); /* Wake the pager */ - } - } - -#endif /* WAKE_PAGER */ - #ifdef illumos /* * check that we're out of range of the pageout scanner. It starts to @@ -6354,9 +6312,6 @@ arc_init(void) printf(" in /boot/loader.conf.\n"); } #endif -#ifdef WAKE_PAGER - arc_init_done++; /* For anyone who wants to know */ -#endif /* WAKE_PAGER */ } void -- 2.11.0