* The cache page zone is initialized later since we need to be able to allocate * pages before UMA is fully initialized. */
| 206 | * pages before UMA is fully initialized. |
| 207 | */ |
| 208 | static void |
| 209 | vm_page_init_cache_zones(void *dummy __unused) |
| 210 | { |
| 211 | struct vm_domain *vmd; |
| 212 | struct vm_pgcache *pgcache; |
| 213 | int cache, domain, maxcache, pool; |
| 214 | |
| 215 | maxcache = 0; |
| 216 | TUNABLE_INT_FETCH("vm.pgcache_zone_max_pcpu", &maxcache); |
| 217 | maxcache *= mp_ncpus; |
| 218 | for (domain = 0; domain < vm_ndomains; domain++) { |
| 219 | vmd = VM_DOMAIN(domain); |
| 220 | for (pool = 0; pool < VM_NFREEPOOL; pool++) { |
| 221 | pgcache = &vmd->vmd_pgcache[pool]; |
| 222 | pgcache->domain = domain; |
| 223 | pgcache->pool = pool; |
| 224 | pgcache->zone = uma_zcache_create("vm pgcache", |
| 225 | PAGE_SIZE, NULL, NULL, NULL, NULL, |
| 226 | vm_page_zone_import, vm_page_zone_release, pgcache, |
| 227 | UMA_ZONE_VM); |
| 228 | |
| 229 | /* |
| 230 | * Limit each pool's zone to 0.1% of the pages in the |
| 231 | * domain. |
| 232 | */ |
| 233 | cache = maxcache != 0 ? maxcache : |
| 234 | vmd->vmd_page_count / 1000; |
| 235 | uma_zone_set_maxcache(pgcache->zone, cache); |
| 236 | } |
| 237 | } |
| 238 | } |
| 239 | SYSINIT(vm_page2, SI_SUB_VM_CONF, SI_ORDER_ANY, vm_page_init_cache_zones, NULL); |
| 240 | |
| 241 | /* Make sure that u_long is at least 64 bits when PAGE_SIZE is 32K. */ |
nothing calls this directly
no test coverage detected