* Signal a free page shortage to subsystems that have registered an event * handler. Reclaim memory from UMA in the event of a severe shortage. * Return true if the free page count should be re-evaluated. */
| 2037 | * Return true if the free page count should be re-evaluated. |
| 2038 | */ |
| 2039 | static bool |
| 2040 | vm_pageout_lowmem(void) |
| 2041 | { |
| 2042 | static int lowmem_ticks = 0; |
| 2043 | int last; |
| 2044 | bool ret; |
| 2045 | |
| 2046 | ret = false; |
| 2047 | |
| 2048 | last = atomic_load_int(&lowmem_ticks); |
| 2049 | while ((u_int)(ticks - last) / hz >= lowmem_period) { |
| 2050 | if (atomic_fcmpset_int(&lowmem_ticks, &last, ticks) == 0) |
| 2051 | continue; |
| 2052 | |
| 2053 | /* |
| 2054 | * Decrease registered cache sizes. |
| 2055 | */ |
| 2056 | SDT_PROBE0(vm, , , vm__lowmem_scan); |
| 2057 | EVENTHANDLER_INVOKE(vm_lowmem, VM_LOW_PAGES); |
| 2058 | |
| 2059 | /* |
| 2060 | * We do this explicitly after the caches have been |
| 2061 | * drained above. |
| 2062 | */ |
| 2063 | uma_reclaim(UMA_RECLAIM_TRIM); |
| 2064 | ret = true; |
| 2065 | break; |
| 2066 | } |
| 2067 | |
| 2068 | /* |
| 2069 | * Kick off an asynchronous reclaim of cached memory if one of the |
| 2070 | * page daemons is failing to keep up with demand. Use the "severe" |
| 2071 | * threshold instead of "min" to ensure that we do not blow away the |
| 2072 | * caches if a subset of the NUMA domains are depleted by kernel memory |
| 2073 | * allocations; the domainset iterators automatically skip domains |
| 2074 | * below the "min" threshold on the first pass. |
| 2075 | * |
| 2076 | * UMA reclaim worker has its own rate-limiting mechanism, so don't |
| 2077 | * worry about kicking it too often. |
| 2078 | */ |
| 2079 | if (vm_page_count_severe()) |
| 2080 | uma_reclaim_wakeup(); |
| 2081 | |
| 2082 | return (ret); |
| 2083 | } |
| 2084 | |
| 2085 | static void |
| 2086 | vm_pageout_worker(void *arg) |
no test coverage detected