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

Function arc_init

freebsd/contrib/openzfs/module/zfs/arc.c:7598–7704  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7596 arc_c_max = arc_default_max(arc_c_min, allmem);
7597}
7598void
7599arc_init(void)
7600{
7601 uint64_t percent, allmem = arc_all_memory();
7602 mutex_init(&arc_evict_lock, NULL, MUTEX_DEFAULT, NULL);
7603 list_create(&arc_evict_waiters, sizeof (arc_evict_waiter_t),
7604 offsetof(arc_evict_waiter_t, aew_node));
7605
7606 arc_min_prefetch_ms = 1000;
7607 arc_min_prescient_prefetch_ms = 6000;
7608
7609#if defined(_KERNEL)
7610 arc_lowmem_init();
7611#endif
7612
7613 arc_set_limits(allmem);
7614
7615#ifndef _KERNEL
7616 /*
7617 * In userland, there's only the memory pressure that we artificially
7618 * create (see arc_available_memory()). Don't let arc_c get too
7619 * small, because it can cause transactions to be larger than
7620 * arc_c, causing arc_tempreserve_space() to fail.
7621 */
7622 arc_c_min = MAX(arc_c_max / 2, 2ULL << SPA_MAXBLOCKSHIFT);
7623#endif
7624
7625 arc_c = arc_c_min;
7626 arc_p = (arc_c >> 1);
7627
7628 /* Set min to 1/2 of arc_c_min */
7629 arc_meta_min = 1ULL << SPA_MAXBLOCKSHIFT;
7630 /* Initialize maximum observed usage to zero */
7631 arc_meta_max = 0;
7632 /*
7633 * Set arc_meta_limit to a percent of arc_c_max with a floor of
7634 * arc_meta_min, and a ceiling of arc_c_max.
7635 */
7636 percent = MIN(zfs_arc_meta_limit_percent, 100);
7637 arc_meta_limit = MAX(arc_meta_min, (percent * arc_c_max) / 100);
7638 percent = MIN(zfs_arc_dnode_limit_percent, 100);
7639 arc_dnode_size_limit = (percent * arc_meta_limit) / 100;
7640
7641 /* Apply user specified tunings */
7642 arc_tuning_update(B_TRUE);
7643
7644 /* if kmem_flags are set, lets try to use less memory */
7645 if (kmem_debugging())
7646 arc_c = arc_c / 2;
7647 if (arc_c < arc_c_min)
7648 arc_c = arc_c_min;
7649
7650 arc_register_hotplug();
7651
7652 arc_state_init();
7653
7654 buf_init();
7655

Callers 1

dmu_initFunction · 0.85

Calls 15

arc_set_limitsFunction · 0.85
arc_tuning_updateFunction · 0.85
arc_state_initFunction · 0.85
buf_initFunction · 0.85
kstat_createFunction · 0.85
zthr_createFunction · 0.85
zthr_create_timerFunction · 0.85
arc_all_memoryFunction · 0.50
mutex_initFunction · 0.50
list_createFunction · 0.50
arc_lowmem_initFunction · 0.50
kmem_debuggingFunction · 0.50

Tested by

no test coverage detected