MCPcopy Create free account
hub / github.com/F-Stack/f-stack / vm_page_init_cache_zones

Function vm_page_init_cache_zones

freebsd/vm/vm_page.c:208–238  ·  view source on GitHub ↗

* The cache page zone is initialized later since we need to be able to allocate * pages before UMA is fully initialized. */

Source from the content-addressed store, hash-verified

206 * pages before UMA is fully initialized.
207 */
208static void
209vm_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}
239SYSINIT(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. */

Callers

nothing calls this directly

Calls 2

uma_zcache_createFunction · 0.85
uma_zone_set_maxcacheFunction · 0.85

Tested by

no test coverage detected