FreeBSD kernel kern code
|
#include <sys/cdefs.h>
#include "opt_ddb.h"
#include "opt_vm.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/asan.h>
#include <sys/kdb.h>
#include <sys/kernel.h>
#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/msan.h>
#include <sys/mutex.h>
#include <sys/vmmeter.h>
#include <sys/proc.h>
#include <sys/queue.h>
#include <sys/sbuf.h>
#include <sys/smp.h>
#include <sys/sysctl.h>
#include <sys/time.h>
#include <sys/vmem.h>
#include <vm/vm.h>
#include <vm/pmap.h>
#include <vm/vm_domainset.h>
#include <vm/vm_pageout.h>
#include <vm/vm_param.h>
#include <vm/vm_kern.h>
#include <vm/vm_extern.h>
#include <vm/vm_map.h>
#include <vm/vm_page.h>
#include <vm/vm_phys.h>
#include <vm/vm_pagequeue.h>
#include <vm/uma.h>
#include <vm/uma_int.h>
#include <vm/uma_dbg.h>
#include <ddb/ddb.h>
Go to the source code of this file.
Macros | |
#define | DEBUG_REDZONE_ARG_DEF |
#define | DEBUG_REDZONE_ARG |
#define | REALLOC_FRACTION 1 /* new block if <= half the size */ |
#define | KMEM_ZSHIFT 4 |
#define | KMEM_ZBASE 16 |
#define | KMEM_ZMASK (KMEM_ZBASE - 1) |
#define | KMEM_ZMAX 65536 |
#define | KMEM_ZSIZE (KMEM_ZMAX >> KMEM_ZSHIFT) |
#define | MALLOC_DEBUG_MAXZONES 1 |
Functions | |
__FBSDID ("$FreeBSD$") | |
MALLOC_DEFINE (M_CACHE, "cache", "Various Dynamically allocated caches") | |
MALLOC_DEFINE (M_DEVBUF, "devbuf", "device driver memory") | |
MALLOC_DEFINE (M_TEMP, "temp", "misc temporary data buffers") | |
SYSCTL_ULONG (_vm, OID_AUTO, kmem_size, CTLFLAG_RDTUN, &vm_kmem_size, 0, "Size of kernel memory") | |
SYSCTL_ULONG (_vm, OID_AUTO, kmem_zmax, CTLFLAG_RDTUN, &kmem_zmax, 0, "Maximum allocation size that malloc(9) would use UMA as backend") | |
SYSCTL_ULONG (_vm, OID_AUTO, kmem_size_min, CTLFLAG_RDTUN, &vm_kmem_size_min, 0, "Minimum size of kernel memory") | |
SYSCTL_ULONG (_vm, OID_AUTO, kmem_size_max, CTLFLAG_RDTUN, &vm_kmem_size_max, 0, "Maximum size of kernel memory") | |
SYSCTL_UINT (_vm, OID_AUTO, kmem_size_scale, CTLFLAG_RDTUN, &vm_kmem_size_scale, 0, "Scale factor for kernel memory size") | |
static int | sysctl_kmem_map_size (SYSCTL_HANDLER_ARGS) |
SYSCTL_PROC (_vm, OID_AUTO, kmem_map_size, CTLFLAG_RD|CTLTYPE_ULONG|CTLFLAG_MPSAFE, NULL, 0, sysctl_kmem_map_size, "LU", "Current kmem allocation size") | |
static int | sysctl_kmem_map_free (SYSCTL_HANDLER_ARGS) |
SYSCTL_PROC (_vm, OID_AUTO, kmem_map_free, CTLFLAG_RD|CTLTYPE_ULONG|CTLFLAG_MPSAFE, NULL, 0, sysctl_kmem_map_free, "LU", "Free space in kmem") | |
static | SYSCTL_NODE (_vm, OID_AUTO, malloc, CTLFLAG_RD|CTLFLAG_MPSAFE, 0, "Malloc information") |
SYSCTL_UINT (_vm_malloc, OID_AUTO, zone_count, CTLFLAG_RD, &vm_malloc_zone_count, 0, "Number of malloc zones") | |
static int | sysctl_vm_malloc_zone_sizes (SYSCTL_HANDLER_ARGS) |
SYSCTL_PROC (_vm_malloc, OID_AUTO, zone_sizes, CTLFLAG_RD|CTLTYPE_OPAQUE|CTLFLAG_MPSAFE, NULL, 0, sysctl_vm_malloc_zone_sizes, "S", "Zone sizes used by malloc") | |
static int | sysctl_kern_malloc_stats (SYSCTL_HANDLER_ARGS) |
static void | mtp_set_subzone (struct malloc_type *mtp) |
static u_int | mtp_get_subzone (struct malloc_type *mtp) |
static void | malloc_type_zone_allocated (struct malloc_type *mtp, unsigned long size, int zindx) |
void | malloc_type_allocated (struct malloc_type *mtp, unsigned long size) |
void | malloc_type_freed (struct malloc_type *mtp, unsigned long size) |
void * | contigmalloc (unsigned long size, struct malloc_type *type, int flags, vm_paddr_t low, vm_paddr_t high, unsigned long alignment, vm_paddr_t boundary) |
void * | contigmalloc_domainset (unsigned long size, struct malloc_type *type, struct domainset *ds, int flags, vm_paddr_t low, vm_paddr_t high, unsigned long alignment, vm_paddr_t boundary) |
void | contigfree (void *addr, unsigned long size, struct malloc_type *type) |
static bool | malloc_large_slab (uma_slab_t slab) |
static size_t | malloc_large_size (uma_slab_t slab) |
static caddr_t __noinline | malloc_large (size_t size, struct malloc_type *mtp, struct domainset *policy, int flags DEBUG_REDZONE_ARG_DEF) |
static void | free_large (void *addr, size_t size) |
void *() | malloc (size_t size, struct malloc_type *mtp, int flags) |
static void * | malloc_domain (size_t *sizep, int *indxp, struct malloc_type *mtp, int domain, int flags) |
void * | malloc_domainset (size_t size, struct malloc_type *mtp, struct domainset *ds, int flags) |
void * | malloc_exec (size_t size, struct malloc_type *mtp, int flags) |
void * | malloc_domainset_exec (size_t size, struct malloc_type *mtp, struct domainset *ds, int flags) |
void * | malloc_aligned (size_t size, size_t align, struct malloc_type *type, int flags) |
void * | malloc_domainset_aligned (size_t size, size_t align, struct malloc_type *mtp, struct domainset *ds, int flags) |
void * | mallocarray (size_t nmemb, size_t size, struct malloc_type *type, int flags) |
void * | mallocarray_domainset (size_t nmemb, size_t size, struct malloc_type *type, struct domainset *ds, int flags) |
void | free (void *addr, struct malloc_type *mtp) |
void | zfree (void *addr, struct malloc_type *mtp) |
void * | realloc (void *addr, size_t size, struct malloc_type *mtp, int flags) |
void * | reallocf (void *addr, size_t size, struct malloc_type *mtp, int flags) |
size_t | malloc_size (size_t size) |
size_t | malloc_usable_size (const void *addr) |
CTASSERT (VM_KMEM_SIZE_SCALE >=1) | |
void | kmeminit (void) |
static void | mallocinit (void *dummy) |
SYSINIT (kmem, SI_SUB_KMEM, SI_ORDER_SECOND, mallocinit, NULL) | |
void | malloc_init (void *data) |
void | malloc_uninit (void *data) |
struct malloc_type * | malloc_desc2type (const char *desc) |
SYSCTL_PROC (_kern, OID_AUTO, malloc_stats, CTLFLAG_RD|CTLTYPE_STRUCT|CTLFLAG_MPSAFE, 0, 0, sysctl_kern_malloc_stats, "s,malloc_type_ustats", "Return malloc types") | |
SYSCTL_INT (_kern, OID_AUTO, malloc_count, CTLFLAG_RD, &kmemcount, 0, "Count of kernel malloc types") | |
void | malloc_type_list (malloc_type_list_func_t *func, void *arg) |
Variables | |
static struct malloc_type * | kmemstatistics |
static int | kmemcount |
static uint8_t | kmemsize [KMEM_ZSIZE+1] |
static int | numzones = MALLOC_DEBUG_MAXZONES |
struct { | |
int kz_size | |
const char * kz_name | |
uma_zone_t kz_zone [MALLOC_DEBUG_MAXZONES] | |
} | kmemzones [] |
u_long | vm_kmem_size |
static u_long | kmem_zmax = KMEM_ZMAX |
static u_long | vm_kmem_size_min |
static u_long | vm_kmem_size_max |
static u_int | vm_kmem_size_scale |
static u_int | vm_malloc_zone_count = nitems(kmemzones) |
struct mtx | malloc_mtx |
#define DEBUG_REDZONE_ARG |
Definition at line 120 of file kern_malloc.c.
#define DEBUG_REDZONE_ARG_DEF |
Definition at line 119 of file kern_malloc.c.
#define KMEM_ZBASE 16 |
Definition at line 144 of file kern_malloc.c.
#define KMEM_ZMASK (KMEM_ZBASE - 1) |
Definition at line 145 of file kern_malloc.c.
#define KMEM_ZMAX 65536 |
Definition at line 147 of file kern_malloc.c.
#define KMEM_ZSHIFT 4 |
Definition at line 143 of file kern_malloc.c.
#define KMEM_ZSIZE (KMEM_ZMAX >> KMEM_ZSHIFT) |
Definition at line 148 of file kern_malloc.c.
#define MALLOC_DEBUG_MAXZONES 1 |
Definition at line 152 of file kern_malloc.c.
#define REALLOC_FRACTION 1 /* new block if <= half the size */ |
Definition at line 130 of file kern_malloc.c.
__FBSDID | ( | "$FreeBSD$" | ) |
void contigfree | ( | void * | addr, |
unsigned long | size, | ||
struct malloc_type * | type | ||
) |
Definition at line 494 of file kern_malloc.c.
References addr, malloc_type_freed(), and type.
void * contigmalloc | ( | unsigned long | size, |
struct malloc_type * | type, | ||
int | flags, | ||
vm_paddr_t | low, | ||
vm_paddr_t | high, | ||
unsigned long | alignment, | ||
vm_paddr_t | boundary | ||
) |
Definition at line 459 of file kern_malloc.c.
References flags, malloc_type_allocated(), and type.
Referenced by alloc_bounce_pages().
void * contigmalloc_domainset | ( | unsigned long | size, |
struct malloc_type * | type, | ||
struct domainset * | ds, | ||
int | flags, | ||
vm_paddr_t | low, | ||
vm_paddr_t | high, | ||
unsigned long | alignment, | ||
vm_paddr_t | boundary | ||
) |
Definition at line 473 of file kern_malloc.c.
References flags, malloc_type_allocated(), and type.
Referenced by alloc_bounce_pages().
CTASSERT | ( | VM_KMEM_SIZE_SCALE >= | 1 | ) |
void free | ( | void * | addr, |
struct malloc_type * | mtp | ||
) |
Definition at line 907 of file kern_malloc.c.
References addr, free_large(), malloc_large_size(), malloc_large_slab(), malloc_type_freed(), and panic().
Referenced by _eventhandler_deregister(), _fdrop(), _gtaskqueue_create(), _taskqueue_create(), _taskqueue_start_threads(), accept1(), accept_filt_getopt(), accept_filt_setopt(), acctwatch(), acl_free(), aio_aqueue(), aio_biocleanup(), aio_free_entry(), aio_qbio(), alloc_bounce_pages(), alq_destroy(), blist_destroy(), buf_ring_free(), busdma_bufalloc_destroy(), cf_get_method(), cf_levels_method(), cf_set_method(), clock_unregister(), clone_cleanup(), cluster_collectbufs(), cluster_write(), config_intrhook_oneshot_func(), constty_set(), copyiniov(), copyinuio(), coredump(), corefile_open(), cpufreq_add_levels(), cpufreq_curr_sysctl(), cpufreq_detach(), cpufreq_dup_set(), cpufreq_settings_sysctl(), crextend(), crfree_final(), destroy_vpollinfo_free(), dev_unlock_and_free(), dev_wired_cache_fini(), devclass_add_device(), devclass_alloc_unit(), devclass_delete_device(), devclass_delete_driver(), devctl2_ioctl(), device_free_softc(), device_set_desc_internal(), device_set_driver(), device_set_softc(), devstat_alloc(), dirent_exists(), do_execve(), do_osd_del(), dpcpu_alloc(), dpcpu_free(), elf_set_delete(), eventfd_close(), eventhandler_find_or_create_list(), eventhandler_prune_list(), exec_free_args(), exec_register(), exec_unregister(), exit1(), fdclearlocks(), fdescfree_fds(), fdgrowtable(), filecaps_free(), filecaps_free_finish(), filt_timerdetach(), firmware_register(), firmware_unregister(), flushbufqueues(), free_mntarg(), freebsd_copyout_auxargs(), get_interp(), get_proc_vector(), get_ps_strings(), getsockaddr(), graph_alloc_vertex(), graph_free_vertex(), graph_remove_edge(), gtaskqueue_free(), hashdestroy(), hhook_add_hook(), hhook_add_hook_lookup(), hhook_head_destroy(), hhook_remove_hook(), imgact_binmisc_destroy_entry(), imgact_binmisc_get_all_entries(), int_rman_release_resource(), intr_activate_irq(), intr_alloc_msi(), intr_deactivate_irq(), intr_event_add_handler(), intr_event_destroy(), intr_event_remove_handler(), intr_free_intr_map_data(), intr_release_msi(), intr_unmap_irq(), ithread_loop(), itimers_alloc(), itimers_event_exit_exec(), kcov_free(), kdtrace_proc_dtor(), kdtrace_thread_dtor(), kenv_dump(), kern___realpathat(), kern___sysctlbyname(), kern_accept4(), kern_alternate_path(), kern_cpuset_getaffinity(), kern_cpuset_getdomain(), kern_cpuset_setaffinity(), kern_cpuset_setdomain(), kern_fcntl(), kern_getfsstat(), kern_getpeername(), kern_getsockname(), kern_jail(), kern_jail_set(), kern_poll(), kern_posix_fadvise(), kern_proc_cwd_out(), kern_proc_filedesc_out(), kern_proc_vmmap_out(), kern_ptrace(), kern_recvit(), kern_select(), kern_semctl(), kern_setenv(), kern_shm_open2(), kern_unmount(), kerneldumpcomp_create(), kerneldumpcomp_destroy(), kmsan_thread_free(), kn_list_unlock(), knlist_detach(), kobj_class_compile1(), kobj_class_free(), kobj_create(), kobj_delete(), kqueue_close(), kqueue_destroy(), kqueue_expand(), ksched_detach(), ksem_create(), ksem_drop(), ksem_remove(), ktls_alloc_thread(), ktls_encrypt_async(), ktls_encrypt_cb(), lf_advlockasync(), lf_free_edge(), lf_free_lock(), lf_iteratelocks_sysid(), lf_iteratelocks_vnode(), lf_purgelocks(), lim_free(), lim_freen(), link_elf_ctf_get(), link_elf_load_file(), link_elf_lookup_set(), link_elf_unload_file(), linker_file_unload(), linker_find_file_by_name(), linker_hints_lookup(), linker_load_module(), linker_lookup_file(), load_file(), load_interp(), log_console(), loginclass_find(), loginclass_free(), m_tag_free_default(), make_dev_physpath_alias(), malloc_type_list(), mi_startup(), module_release(), mount_devctl_event(), mqueue_free(), mqueue_freemsg(), mqueue_loadmsg(), msgunload(), mtx_pool_destroy(), nameicap_cleanup_from(), ncfreetbl(), note_prpsinfo(), note_threadmd(), notify(), osd_free_reserved(), osd_register(), osd_set_reserved(), pargs_free(), parse_dir_md(), parse_dir_onfail(), parse_dir_timeout(), parse_directive(), parse_mount(), parse_mountroot_options(), parse_notes(), pddrop(), physio(), prison_add_allow(), prison_add_vfs(), prison_deref(), proc_get_binpath(), proc_getauxv(), proc_read_regset(), proc_write_regset(), procdesc_free(), pstats_free(), ptrace_vm_entry(), ptsdrv_free(), putnote(), quiesce_cpus(), realloc(), reallocf(), reap_getpids(), reap_kill(), resource_list_delete(), resource_list_free(), resource_list_purge(), rman_adjust_resource(), rman_fini(), rman_manage_region(), rman_reserve_resource_bound(), root_mount_rel(), sbuf_print_witness_badstacks(), selfdfree(), seltdfini(), semunload(), sendfile(), sendfile_iodone(), sendfile_sync_destroy(), sendit(), sess_release(), set_rootvnode(), sglist_free(), shm_copyin_path(), shm_drop(), shm_remove(), shmexit_myhook(), shmrealloc(), shmunload(), sigacts_free(), sigiofree(), soo_fill_kinfo(), stack_destroy(), start_init(), static_hints_to_env(), stats_tpl_sample_rates(), sys_aio_suspend(), sys_bind(), sys_bindat(), sys_connect(), sys_connectat(), sys_fhstatfs(), sys_fstatfs(), sys_ioctl(), sys_jail_get(), sys_jail_set(), sys_kenv(), sys_kldfind(), sys_kldload(), sys_kldstat(), sys_kldsym(), sys_ksem_unlink(), sys_lio_listio(), sys_mount(), sys_nmount(), sys_preadv(), sys_pwritev(), sys_readv(), sys_recvmsg(), sys_semop(), sys_sendmsg(), sys_setgroups(), sys_setsid(), sys_shm_rename(), sys_shm_unlink(), sys_statfs(), sys_utrace(), sys_uuidgen(), sys_writev(), sysctl_add_oid(), sysctl_ctx_entry_del(), sysctl_ctx_free(), sysctl_debug_ktr_entries(), sysctl_devices(), sysctl_handle_counter_u64_array(), sysctl_handle_string(), sysctl_intrcnt(), sysctl_jail_list(), sysctl_kern_proc_pathname(), sysctl_kern_ttys(), sysctl_remove_oid_locked(), sysctl_rename_oid(), sysctl_sysctl_name2oid(), sysctl_try_reclaim_vnode(), sysinit_add(), taskqgroup_binder(), taskqueue_free(), thread_reap_barrier(), tslog_user(), tty_alloc_mutex(), tty_dealloc(), uifind(), uifree(), uipc_bindat(), uipc_detach(), umtxq_free(), unp_connectat(), unp_externalize(), unp_freerights(), unp_gc(), unp_pcblist(), unp_process_defers(), user_getpeername(), user_getsockname(), vfs_domount(), vfs_domount_update(), vfs_donmount(), vfs_emptydir(), vfs_export(), vfs_free_netcred(), vfs_freeopt(), vfs_freeopts(), vfs_hang_addrlist(), vfs_hash_changesize(), vfs_mountroot_conf0(), vfs_nonvmio_extend(), vfs_nonvmio_truncate(), vfs_read_dirent(), vfs_setpublicfs(), vmem_destroy1(), vmem_rehash(), vn_fill_kinfo_vnode(), vn_free_marker(), vn_fullpath(), vn_fullpath_global(), vn_fullpath_hardlink(), vn_generic_copy_file_range(), vn_io_fault1(), vn_path_to_global_path(), vop_stdallocate(), and vop_stdvptocnp().
|
static |
Definition at line 616 of file kern_malloc.c.
References addr.
Referenced by free(), and zfree().
void kmeminit | ( | void | ) |
Definition at line 1131 of file kern_malloc.c.
References kmem_zmax, panic(), vm_kmem_size, vm_kmem_size_max, vm_kmem_size_min, and vm_kmem_size_scale.
Referenced by mallocinit().
void *() malloc | ( | size_t | size, |
struct malloc_type * | mtp, | ||
int | flags | ||
) |
Definition at line 631 of file kern_malloc.c.
References DEBUG_REDZONE_ARG, flags, kasan_mark(), KMEM_ZBASE, KMEM_ZMASK, kmem_zmax, KMEM_ZSHIFT, kmemsize, kmemzones, kmsan_mark(), kmsan_orig(), malloc_large(), malloc_type_zone_allocated(), and mtp_get_subzone().
Referenced by _gtaskqueue_create(), _gtaskqueue_start_threads(), _taskqueue_create(), _taskqueue_start_threads(), accept_filt_generic_mod_event(), accept_filt_getopt(), accept_filt_setopt(), acctwatch(), acl_alloc(), aio_qbio(), alloc_bounce_pages(), alloc_bounce_zone(), alloc_sv_tk(), alq_open_flags(), blist_create(), boottrace_init(), buf_ring_alloc(), busdma_bufalloc_create(), cf_get_method(), cf_set_method(), clock_register_flags(), clone_setup(), cloneuio(), cluster_collectbufs(), compressor_init(), config_intrhook_oneshot(), constty_set(), copyiniov(), copyinuio(), coredump(), corefile_open(), cpufreq_add_levels(), cpufreq_attach(), cpufreq_dup_set(), cpufreq_insert_abs(), cpufreq_settings_sysctl(), crextend(), crget(), dev_wired_cache_add(), dev_wired_cache_init(), devclass_add_device(), devclass_add_driver(), devclass_alloc_unit(), devclass_find_internal(), devclass_get_devices(), devclass_get_drivers(), device_get_children(), device_get_path(), device_set_desc_internal(), devstat_alloc(), dirent_exists(), do_execve(), dpcpu_free(), dpcpu_startup(), dumper_insert(), elf_set_add(), eventfd_create_file(), eventhandler_find_or_create_list(), eventhandler_register(), exec_register(), exec_unregister(), fdgrowtable(), filecaps_copy(), filecaps_copy_prep(), filedesc_to_leader_alloc(), filt_timerattach(), firmware_mountroot(), firmware_register(), flushbufqueues(), freebsd_copyout_auxargs(), fsetown(), get_interp(), get_proc_vector(), getsockaddr(), graph_add_edge(), graph_alloc_vertex(), graph_init(), hashinit_flags(), hhook_add_hook(), hhook_add_hook_lookup(), hhook_head_register(), imgact_binmisc_get_all_entries(), imgact_binmisc_new_entry(), init_dynamic_kenv(), init_dynamic_kenv_from(), init_hwpmc(), int_alloc_resource(), intr_alloc_map_data(), intr_alloc_msi(), intr_event_add_handler(), intr_event_create(), intr_map_copy_map_data(), intr_map_irq(), intr_pic_add_handler(), intr_release_msi(), ithread_create(), itimers_alloc(), kcov_open(), kdtrace_proc_ctor(), kdtrace_thread_ctor(), kenv_dump(), kern___sysctlbyname(), kern_alternate_path(), kern_cpuset_getaffinity(), kern_cpuset_getdomain(), kern_cpuset_setaffinity(), kern_cpuset_setdomain(), kern_fcntl(), kern_getfsstat(), kern_jail(), kern_jail_set(), kern_kqueue(), kern_posix_fadvise(), kern_proc_cwd_out(), kern_proc_filedesc_out(), kern_proc_vmmap_out(), kern_ptrace(), kern_select(), kern_semctl(), kern_setenv(), kern_shmat_locked(), kern_unmount(), kerneldumpcomp_create(), kmsan_thread_alloc(), knlist_alloc(), kobj_class_compile1(), kobj_create(), kqueue_expand(), ksched_attach(), ksem_alloc(), ksem_create(), ksem_insert(), ktls_alloc_thread(), ktls_encrypt_async(), ktls_init(), lf_advlockasync(), lf_alloc_edge(), lf_alloc_lock(), lf_iteratelocks_sysid(), lf_iteratelocks_vnode(), lim_alloc(), link_elf_ctf_get(), link_elf_link_common_finish(), link_elf_link_preload(), link_elf_load_file(), link_elf_lookup_set(), linker_file_lookup_symbol_internal(), linker_find_file_by_name(), linker_hints_lookup(), linker_lookup_file(), load_file(), load_interp(), log_console(), loginclass_find(), m_tag_alloc(), make_dev_physpath_alias(), make_device(), malloc_type_list(), mallocarray(), modlist_newmodule(), module_register(), mount_arg(), mount_argf(), mount_argsu(), mount_devctl_event(), mqueue_loadmsg(), msginit(), mtx_pool_create(), nameicap_tracker_add(), nchinit(), nchinittbl(), note_prpsinfo(), note_threadmd(), notify(), osd_register(), osd_reserve(), pargs_alloc(), parse_dir_md(), parse_mount(), parse_notes(), parse_token(), pdinit(), phashinit_flags(), physio(), pic_create(), prep_cdevsw(), proc_read_regset(), proc_write_regset(), procdesc_new(), procinit(), pstats_alloc(), pts_alloc(), pts_alloc_external(), putnote(), quiesce_cpus(), realloc(), reap_getpids(), reap_kill_sched(), register_note(), register_regset_note(), resource_list_add(), rman_init(), rman_reserve_resource_bound(), root_mount_hold(), sbuf_print_witness_badstacks(), selfdalloc(), seltdinit(), seminit(), sglist_alloc(), shm_alloc(), shm_copyin_path(), shm_insert(), shmfork_myhook(), shminit(), shmrealloc(), sigacts_alloc(), sodupsockaddr(), stack_create(), static_hints_to_env(), stats_strdup(), stats_tpl_sample_rates(), sys_aio_suspend(), sys_fhstatfs(), sys_fstatfs(), sys_ioctl(), sys_kenv(), sys_kldfind(), sys_kldload(), sys_kldstat(), sys_kldsym(), sys_ksem_unlink(), sys_lio_listio(), sys_mount(), sys_semop(), sys_setgroups(), sys_setsid(), sys_statfs(), sys_utrace(), sys_uuidgen(), sysctl_add_oid(), sysctl_ctx_entry_add(), sysctl_debug_ktr_entries(), sysctl_devices(), sysctl_escape_name(), sysctl_handle_counter_u64_array(), sysctl_handle_string(), sysctl_intrcnt(), sysctl_jail_list(), sysctl_kern_proc_pathname(), sysctl_kern_ttys(), sysctl_sysctl_name2oid(), sysctl_try_reclaim_vnode(), sysinit_add(), taskqgroup_bind(), taskqgroup_create(), termcn_cnregister(), terminal_alloc(), thread_reap_barrier(), threadinit(), tty_alloc_mutex(), uifind(), uipc_accept(), uipc_bindat(), uipc_peeraddr(), uipc_sockaddr(), umtxq_alloc(), unp_connectat(), unp_discard(), unp_gc(), unp_internalize(), unp_pcblist(), v_addpollinfo(), vfs_buildopts(), vfs_domount(), vfs_domount_update(), vfs_emptydir(), vfs_export(), vfs_hang_addrlist(), vfs_mergeopts(), vfs_mountroot_devfs(), vfs_nonvmio_extend(), vfs_remount_ro(), vfs_setpublicfs(), vmem_rehash(), vn_alloc_marker(), vn_fullpath(), vn_fullpath_global(), vn_fullpath_hardlink(), vn_generic_copy_file_range(), vn_sendfile(), vop_stdallocate(), and vop_stdvptocnp().
void * malloc_aligned | ( | size_t | size, |
size_t | align, | ||
struct malloc_type * | type, | ||
int | flags | ||
) |
Definition at line 787 of file kern_malloc.c.
References flags, malloc_domainset_aligned(), and type.
MALLOC_DEFINE | ( | M_CACHE | , |
"cache" | , | ||
"Various Dynamically allocated caches" | |||
) |
MALLOC_DEFINE | ( | M_DEVBUF | , |
"devbuf" | , | ||
"device driver memory" | |||
) |
MALLOC_DEFINE | ( | M_TEMP | , |
"temp" | , | ||
"misc temporary data buffers" | |||
) |
struct malloc_type * malloc_desc2type | ( | const char * | desc | ) |
Definition at line 1344 of file kern_malloc.c.
References kmemstatistics, and malloc_mtx.
|
static |
Definition at line 682 of file kern_malloc.c.
References domain, flags, KMEM_ZBASE, KMEM_ZMASK, kmem_zmax, KMEM_ZSHIFT, kmemsize, kmemzones, and mtp_get_subzone().
Referenced by malloc_domainset().
void * malloc_domainset | ( | size_t | size, |
struct malloc_type * | mtp, | ||
struct domainset * | ds, | ||
int | flags | ||
) |
Definition at line 705 of file kern_malloc.c.
References DEBUG_REDZONE_ARG, domain, flags, kasan_mark(), kmem_zmax, kmsan_mark(), kmsan_orig(), malloc_domain(), malloc_large(), and malloc_type_zone_allocated().
Referenced by alloc_bounce_pages(), callout_cpu_init(), device_set_driver(), init_hwpmc(), malloc_domainset_aligned(), and mallocarray_domainset().
void * malloc_domainset_aligned | ( | size_t | size, |
size_t | align, | ||
struct malloc_type * | mtp, | ||
struct domainset * | ds, | ||
int | flags | ||
) |
Definition at line 794 of file kern_malloc.c.
References flags, malloc_domainset(), and res.
Referenced by malloc_aligned().
void * malloc_domainset_exec | ( | size_t | size, |
struct malloc_type * | mtp, | ||
struct domainset * | ds, | ||
int | flags | ||
) |
Definition at line 765 of file kern_malloc.c.
References DEBUG_REDZONE_ARG, flags, and malloc_large().
Referenced by malloc_exec().
void * malloc_exec | ( | size_t | size, |
struct malloc_type * | mtp, | ||
int | flags | ||
) |
Definition at line 758 of file kern_malloc.c.
References flags, and malloc_domainset_exec().
Referenced by link_elf_load_file().
void malloc_init | ( | void * | data | ) |
Definition at line 1270 of file kern_malloc.c.
References data, kmemcount, kmemstatistics, malloc_mtx, mtp_set_subzone(), panic(), and pcpu_zone_64.
|
static |
Definition at line 588 of file kern_malloc.c.
References flags, kasan_mark(), and malloc_type_allocated().
Referenced by malloc(), malloc_domainset(), and malloc_domainset_exec().
|
inlinestatic |
Definition at line 579 of file kern_malloc.c.
Referenced by free(), malloc_usable_size(), realloc(), and zfree().
|
inlinestatic |
Definition at line 570 of file kern_malloc.c.
Referenced by free(), malloc_usable_size(), realloc(), and zfree().
size_t malloc_size | ( | size_t | size | ) |
Definition at line 1070 of file kern_malloc.c.
References KMEM_ZBASE, KMEM_ZMASK, kmem_zmax, KMEM_ZSHIFT, kmemsize, kmemzones, and kz_size.
void malloc_type_allocated | ( | struct malloc_type * | mtp, |
unsigned long | size | ||
) |
Definition at line 412 of file kern_malloc.c.
References malloc_type_zone_allocated().
Referenced by contigmalloc(), contigmalloc_domainset(), and malloc_large().
void malloc_type_freed | ( | struct malloc_type * | mtp, |
unsigned long | size | ||
) |
Definition at line 426 of file kern_malloc.c.
Referenced by contigfree(), free(), and zfree().
void malloc_type_list | ( | malloc_type_list_func_t * | func, |
void * | arg | ||
) |
Definition at line 1427 of file kern_malloc.c.
References count, free(), kmemcount, kmemstatistics, malloc(), and malloc_mtx.
|
static |
Definition at line 382 of file kern_malloc.c.
Referenced by malloc(), malloc_domainset(), and malloc_type_allocated().
void malloc_uninit | ( | void * | data | ) |
Definition at line 1294 of file kern_malloc.c.
References data, kmemcount, kmemstatistics, malloc_mtx, mp_maxid, pcpu_zone_64, and printf().
size_t malloc_usable_size | ( | const void * | addr | ) |
Definition at line 1086 of file kern_malloc.c.
References addr, kasan_mark(), malloc_large_size(), malloc_large_slab(), and panic().
void * mallocarray | ( | size_t | nmemb, |
size_t | size, | ||
struct malloc_type * | type, | ||
int | flags | ||
) |
Definition at line 827 of file kern_malloc.c.
References flags, malloc(), panic(), and type.
Referenced by intr_map_init(), and kern_poll().
void * mallocarray_domainset | ( | size_t | nmemb, |
size_t | size, | ||
struct malloc_type * | type, | ||
struct domainset * | ds, | ||
int | flags | ||
) |
Definition at line 837 of file kern_malloc.c.
References flags, malloc_domainset(), panic(), and type.
|
static |
Definition at line 1232 of file kern_malloc.c.
References KMEM_ZBASE, KMEM_ZMAX, kmem_zmax, KMEM_ZSHIFT, kmeminit(), kmemsize, kmemzones, malloc_mtx, name, and numzones.
|
inlinestatic |
Definition at line 368 of file kern_malloc.c.
Referenced by malloc(), and malloc_domain().
|
static |
Definition at line 359 of file kern_malloc.c.
Referenced by malloc_init().
void * realloc | ( | void * | addr, |
size_t | size, | ||
struct malloc_type * | mtp, | ||
int | flags | ||
) |
Definition at line 987 of file kern_malloc.c.
References addr, flags, free(), kasan_mark(), malloc(), malloc_large_size(), malloc_large_slab(), and REALLOC_FRACTION.
Referenced by boottrace_resize(), do_osd_del(), graph_alloc_vertex(), linker_file_add_dependency(), mount_arg(), mount_argf(), osd_deregister(), osd_register(), osd_set_reserved(), reallocf(), stats_realloc(), and vfs_read_dirent().
void * reallocf | ( | void * | addr, |
size_t | size, | ||
struct malloc_type * | mtp, | ||
int | flags | ||
) |
SYSCTL_INT | ( | _kern | , |
OID_AUTO | , | ||
malloc_count | , | ||
CTLFLAG_RD | , | ||
& | kmemcount, | ||
0 | , | ||
"Count of kernel malloc types" | |||
) |
|
static |
Definition at line 1357 of file kern_malloc.c.
References kmemcount, kmemstatistics, malloc_mtx, mp_maxid, sbuf_bcat(), sbuf_clear_flags(), sbuf_delete(), sbuf_finish(), sbuf_new_for_sysctl(), and sysctl_wire_old_buffer().
|
static |
Definition at line 267 of file kern_malloc.c.
References sysctl_handle_long().
|
static |
Definition at line 258 of file kern_malloc.c.
References sysctl_handle_long().
|
static |
SYSCTL_PROC | ( | _kern | , |
OID_AUTO | , | ||
malloc_stats | , | ||
CTLFLAG_RD|CTLTYPE_STRUCT| | CTLFLAG_MPSAFE, | ||
0 | , | ||
0 | , | ||
sysctl_kern_malloc_stats | , | ||
" | s, | ||
malloc_type_ustats" | , | ||
"Return malloc types" | |||
) |
SYSCTL_PROC | ( | _vm | , |
OID_AUTO | , | ||
kmem_map_free | , | ||
CTLFLAG_RD|CTLTYPE_ULONG| | CTLFLAG_MPSAFE, | ||
NULL | , | ||
0 | , | ||
sysctl_kmem_map_free | , | ||
"LU" | , | ||
"Free space in kmem" | |||
) |
SYSCTL_PROC | ( | _vm | , |
OID_AUTO | , | ||
kmem_map_size | , | ||
CTLFLAG_RD|CTLTYPE_ULONG| | CTLFLAG_MPSAFE, | ||
NULL | , | ||
0 | , | ||
sysctl_kmem_map_size | , | ||
"LU" | , | ||
"Current kmem allocation size" | |||
) |
SYSCTL_PROC | ( | _vm_malloc | , |
OID_AUTO | , | ||
zone_sizes | , | ||
CTLFLAG_RD|CTLTYPE_OPAQUE| | CTLFLAG_MPSAFE, | ||
NULL | , | ||
0 | , | ||
sysctl_vm_malloc_zone_sizes | , | ||
"S" | , | ||
"Zone sizes used by malloc" | |||
) |
SYSCTL_UINT | ( | _vm | , |
OID_AUTO | , | ||
kmem_size_scale | , | ||
CTLFLAG_RDTUN | , | ||
& | vm_kmem_size_scale, | ||
0 | , | ||
"Scale factor for kernel memory size" | |||
) |
SYSCTL_UINT | ( | _vm_malloc | , |
OID_AUTO | , | ||
zone_count | , | ||
CTLFLAG_RD | , | ||
& | vm_malloc_zone_count, | ||
0 | , | ||
"Number of malloc zones" | |||
) |
SYSCTL_ULONG | ( | _vm | , |
OID_AUTO | , | ||
kmem_size | , | ||
CTLFLAG_RDTUN | , | ||
& | vm_kmem_size, | ||
0 | , | ||
"Size of kernel memory" | |||
) |
SYSCTL_ULONG | ( | _vm | , |
OID_AUTO | , | ||
kmem_size_max | , | ||
CTLFLAG_RDTUN | , | ||
& | vm_kmem_size_max, | ||
0 | , | ||
"Maximum size of kernel memory" | |||
) |
SYSCTL_ULONG | ( | _vm | , |
OID_AUTO | , | ||
kmem_size_min | , | ||
CTLFLAG_RDTUN | , | ||
& | vm_kmem_size_min, | ||
0 | , | ||
"Minimum size of kernel memory" | |||
) |
SYSCTL_ULONG | ( | _vm | , |
OID_AUTO | , | ||
kmem_zmax | , | ||
CTLFLAG_RDTUN | , | ||
& | kmem_zmax, | ||
0 | , | ||
"Maximum allocation size that malloc(9) would use UMA as backend" | |||
) |
|
static |
Definition at line 282 of file kern_malloc.c.
References kmemzones.
SYSINIT | ( | kmem | , |
SI_SUB_KMEM | , | ||
SI_ORDER_SECOND | , | ||
mallocinit | , | ||
NULL | |||
) |
void zfree | ( | void * | addr, |
struct malloc_type * | mtp | ||
) |
Definition at line 947 of file kern_malloc.c.
References addr, free_large(), kasan_mark(), malloc_large_size(), malloc_large_slab(), malloc_type_freed(), and panic().
Referenced by free_single_dumper(), kern_unsetenv(), kerneldumpcomp_destroy(), and ktls_cleanup().
|
static |
Definition at line 192 of file kern_malloc.c.
Referenced by kmeminit(), malloc(), malloc_domain(), malloc_domainset(), malloc_size(), and mallocinit().
|
static |
Definition at line 141 of file kern_malloc.c.
Referenced by malloc_init(), malloc_type_list(), malloc_uninit(), and sysctl_kern_malloc_stats().
|
static |
Definition at line 149 of file kern_malloc.c.
Referenced by malloc(), malloc_domain(), malloc_size(), and mallocinit().
|
static |
Definition at line 140 of file kern_malloc.c.
Referenced by malloc_desc2type(), malloc_init(), malloc_type_list(), malloc_uninit(), and sysctl_kern_malloc_stats().
struct { ... } kmemzones[] |
Referenced by malloc(), malloc_domain(), malloc_size(), mallocinit(), and sysctl_vm_malloc_zone_sizes().
const char* kz_name |
Definition at line 168 of file kern_malloc.c.
int kz_size |
Definition at line 167 of file kern_malloc.c.
Referenced by malloc_size().
uma_zone_t kz_zone[MALLOC_DEBUG_MAXZONES] |
Definition at line 169 of file kern_malloc.c.
struct mtx malloc_mtx |
Definition at line 234 of file kern_malloc.c.
Referenced by malloc_desc2type(), malloc_init(), malloc_type_list(), malloc_uninit(), mallocinit(), and sysctl_kern_malloc_stats().
|
static |
Definition at line 154 of file kern_malloc.c.
Referenced by mallocinit().
u_long vm_kmem_size |
Definition at line 188 of file kern_malloc.c.
Referenced by kmeminit(), tunable_mbinit(), and vntblinit().
|
static |
Definition at line 200 of file kern_malloc.c.
Referenced by kmeminit().
|
static |
Definition at line 196 of file kern_malloc.c.
Referenced by kmeminit().
|
static |
Definition at line 204 of file kern_malloc.c.
Referenced by kmeminit().
|
static |
Definition at line 221 of file kern_malloc.c.