static int vm_page_zero_check(void) { if (!idlezero_enable) return (0); /* * Attempt to maintain approximately 1/2 of our free pages in a * PG_ZERO'd state. Add some hysteresis to (attempt to) avoid * generally zeroing a page when the system is near steady-state. * Otherwise we might get 'flutter' during disk I/O / IPC or * fast sleeps. We also do not want to be continuously zeroing * pages because doing so may flush our L1 and L2 caches too much. */ if (zero_state && vm_page_zero_count >= ZIDLE_LO(cnt.v_free_count)) return (0); if (vm_page_zero_count >= ZIDLE_HI(cnt.v_free_count)) return (0); return (1); }
/* * Attempt to maintain approximately 1/2 of our free pages in a * PG_ZERO'd state. Add some hysteresis to (attempt to) avoid * generally zeroing a page when the system is near steady-state. * Otherwise we might get 'flutter' during disk I/O / IPC or * fast sleeps. We also do not want to be continuously zeroing * pages because doing so may flush our L1 and L2 caches too much. * * Returns non-zero if pages should be zerod. */ static int vm_page_zero_check(void) { if (idlezero_enable == 0) return (0); if (zero_state == 0) { /* * Wait for the count to fall to LO before starting * to zero pages. */ if (vm_page_zero_count <= ZIDLE_LO(vmstats.v_free_count)) zero_state = 1; } else { /* * Once we are zeroing pages wait for the count to * increase to HI before we stop zeroing pages. */ if (vm_page_zero_count >= ZIDLE_HI(vmstats.v_free_count)) zero_state = 0; } return (zero_state); }