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

Function uma_startup1

freebsd/vm/uma_core.c:2886–2959  ·  view source on GitHub ↗

* Initialize the kernel memory allocator. This is done after pages can be * allocated but before general KVA is available. */

Source from the content-addressed store, hash-verified

2884 * allocated but before general KVA is available.
2885 */
2886void
2887uma_startup1(vm_offset_t virtual_avail)
2888{
2889 struct uma_zctor_args args;
2890 size_t ksize, zsize, size;
2891 uma_keg_t primarykeg;
2892 uintptr_t m;
2893 int domain;
2894 uint8_t pflag;
2895
2896 bootstart = bootmem = virtual_avail;
2897
2898 rw_init(&uma_rwlock, "UMA lock");
2899 sx_init(&uma_reclaim_lock, "umareclaim");
2900
2901 ksize = sizeof(struct uma_keg) +
2902 (sizeof(struct uma_domain) * vm_ndomains);
2903 ksize = roundup(ksize, UMA_SUPER_ALIGN);
2904 zsize = sizeof(struct uma_zone) +
2905 (sizeof(struct uma_cache) * (mp_maxid + 1)) +
2906 (sizeof(struct uma_zone_domain) * vm_ndomains);
2907 zsize = roundup(zsize, UMA_SUPER_ALIGN);
2908
2909 /* Allocate the zone of zones, zone of kegs, and zone of zones keg. */
2910 size = (zsize * 2) + ksize;
2911 for (domain = 0; domain < vm_ndomains; domain++) {
2912 m = (uintptr_t)startup_alloc(NULL, size, domain, &pflag,
2913 M_NOWAIT | M_ZERO);
2914 if (m != 0)
2915 break;
2916 }
2917 zones = (uma_zone_t)m;
2918 m += zsize;
2919 kegs = (uma_zone_t)m;
2920 m += zsize;
2921 primarykeg = (uma_keg_t)m;
2922
2923 /* "manually" create the initial zone */
2924 memset(&args, 0, sizeof(args));
2925 args.name = "UMA Kegs";
2926 args.size = ksize;
2927 args.ctor = keg_ctor;
2928 args.dtor = keg_dtor;
2929 args.uminit = zero_init;
2930 args.fini = NULL;
2931 args.keg = primarykeg;
2932 args.align = UMA_SUPER_ALIGN - 1;
2933 args.flags = UMA_ZFLAG_INTERNAL;
2934 zone_ctor(kegs, zsize, &args, M_WAITOK);
2935
2936 args.name = "UMA Zones";
2937 args.size = zsize;
2938 args.ctor = zone_ctor;
2939 args.dtor = zone_dtor;
2940 args.uminit = zero_init;
2941 args.fini = NULL;
2942 args.keg = NULL;
2943 args.align = UMA_SUPER_ALIGN - 1;

Callers 2

vm_mem_initFunction · 0.85
ff_freebsd_initFunction · 0.85

Calls 7

rw_initFunction · 0.85
startup_allocFunction · 0.85
memsetFunction · 0.85
zone_ctorFunction · 0.85
uma_zcreateFunction · 0.85
bucket_initFunction · 0.85
smr_initFunction · 0.85

Tested by

no test coverage detected