![]() |
MOS Source Code
|
#include "mos/mm/slab.hpp"
#include "mos/assert.hpp"
#include "mos/filesystem/sysfs/sysfs.hpp"
#include "mos/misc/setup.hpp"
#include "mos/mm/mm.hpp"
#include "mos/syslog/printk.hpp"
#include <algorithm>
#include <mos/allocator.hpp>
#include <mos/lib/structures/list.hpp>
#include <mos/lib/sync/spinlock.hpp>
#include <mos/mos_global.h>
#include <mos_stdlib.hpp>
#include <mos_string.hpp>
Go to the source code of this file.
Classes | |
struct | slab_header_t |
struct | slab_metadata_t |
Functions | |
static slab_t * | slab_for (size_t size) |
static ptr_t | slab_impl_new_page (size_t n) |
static void | slab_impl_free_page (ptr_t page, size_t n) |
static void | slab_allocate_mem (slab_t *slab) |
static void | slab_init_one (slab_t *slab, const char *name, size_t size) |
void | slab_init (void) |
initialise the slab allocator | |
void | slab_register (slab_t *slab) |
void * | slab_alloc (size_t size) |
Allocate a block of memory from the slab allocator. | |
void * | slab_calloc (size_t nmemb, size_t size) |
Allocate a block of memory from the slab allocator and zero it. | |
void * | slab_realloc (void *oldptr, size_t new_size) |
Reallocate a block of memory from the slab allocator. | |
void | slab_free (const void *ptr) |
Free a block of memory from the slab allocator. | |
void * | kmemcache_alloc (slab_t *slab) |
void | kmemcache_free (slab_t *slab, const void *addr) |
static bool | slab_sysfs_slabinfo (sysfs_file_t *f) |
MOS_INIT (SYSFS, slab_sysfs_init) | |
Variables | ||
struct { | ||
size_t size | ||
const char * name | ||
} | BUILTIN_SLAB_SIZES [] | |
static slab_t | slabs [MOS_ARRAY_SIZE(BUILTIN_SLAB_SIZES)] | |
static list_head | slabs_list | |
Definition at line 46 of file slab.cpp.
Referenced by slab_alloc().
Definition at line 57 of file slab.cpp.
Referenced by slab_alloc(), and slab_allocate_mem().
Definition at line 64 of file slab.cpp.
Referenced by slab_free().
Definition at line 70 of file slab.cpp.
Referenced by kmemcache_alloc(), and slab_init().
Definition at line 99 of file slab.cpp.
Referenced by slab_init().
initialise the slab allocator
Definition at line 112 of file slab.cpp.
Referenced by mos_start_kernel().
Definition at line 122 of file slab.cpp.
Referenced by Slab< T >::create().
Allocate a block of memory from the slab allocator.
size |
Definition at line 129 of file slab.cpp.
Referenced by slab_calloc(), and slab_realloc().
Free a block of memory from the slab allocator.
addr |
Definition at line 199 of file slab.cpp.
Referenced by slab_realloc().
Definition at line 219 of file slab.cpp.
Referenced by Slab< T >::create(), and slab_alloc().
Definition at line 245 of file slab.cpp.
Referenced by slab_free(), and slab_realloc().
|
static |
Definition at line 263 of file slab.cpp.
Referenced by MOS_INIT().
MOS_INIT | ( | SYSFS | , |
slab_sysfs_init | ) |
size_t size |
Definition at line 34 of file slab.cpp.
Referenced by _null_read(), _null_write(), acpi_find_rsdp(), default_allocator::allocate(), bitmap_create(), check_block_(), console_io_read(), console_io_write(), decode_callback_field(), decode_pointer_field(), decode_static_field(), dentry_dump_refstat(), dentry_path(), dmabuf_share(), dmabuf_share(), dmabuf_unshare(), dmabuf_unshare(), do_kcalloc(), do_kmalloc(), do_krealloc(), do_print_vmflags(), do_roundtrips(), elf_read_file(), encode_array(), fdt_add_mem_rsv(), fdt_add_reservemap_entry(), fdt_appendprop_addrrange(), fdt_get_mem_rsv(), format_size(), fread(), free_with_check(), fwrite(), impl_syscall_dmabuf_unshare(), impl_syscall_io_read(), impl_syscall_io_write(), impl_syscall_mmap_anonymous(), impl_syscall_mmap_file(), impl_syscall_munmap(), impl_syscall_vm_protect(), initrd_read(), int(), io_get_name(), ipc_client_io_read(), ipc_client_io_write(), ipc_client_read(), ipc_client_write(), ipc_msg_create(), ipc_read_as_msg(), ipc_read_msg(), ipc_server_io_read(), ipc_server_io_write(), ipc_server_read(), ipc_server_write(), ipc_write_as_msg(), LLVMFuzzerTestOneInput(), main(), malloc_with_check(), mmap_anonymous(), mmap_file(), mmstat_dec(), mmstat_inc(), MOS_STATIC_ASSERT(), MOS_STATIC_ASSERT(), MOS_STATIC_ASSERT(), munmap(), of_read_number(), dt_reg::iterator::operator*(), pb_dec_bytes(), pb_dec_fixed_length_bytes(), pb_dec_string(), pb_enc_string(), pb_encode_string(), pb_encode_submessage(), pb_get_encoded_size(), pb_make_string_substream(), pipe_read(), pipe_write(), pipeio_io_read(), pipeio_io_write(), print_property_value(), read_raw_value(), realloc_with_check(), ring_buffer_pop_back(), ring_buffer_pop_front(), ring_buffer_pos_pop_back(), ring_buffer_pos_pop_front(), ring_buffer_pos_push_back(), ring_buffer_pos_push_front(), ring_buffer_push_back(), ring_buffer_push_front(), round_blocksize(), rpc_arg_next(), rpc_arg_pb(), rpc_arg_sized_next(), rpc_call_arg(), rpc_write_result(), sbi_console_write(), simple_fill_cache(), simple_page_write_begin(), simple_page_write_end(), slab_alloc(), slab_calloc(), slab_for(), slab_init(), slab_init_one(), snprintf(), stack_grow(), stack_init(), stack_pop(), stack_push(), strtoul(), syscall_dmabuf_unshare(), syscall_io_read(), syscall_io_write(), syscall_mmap_anonymous(), syscall_mmap_file(), syscall_munmap(), syscall_vm_protect(), sysfs_fops_read(), sysfs_fops_write(), vfs_generic_read(), vfs_generic_write(), vfs_getcwd(), vfs_io_ops_getname(), vfs_ipc_file_read(), vfs_ipc_file_write(), vfs_read_pagecache(), vfs_readlinkat(), vfs_simple_write_begin(), vm_protect(), vsnprintf(), vsnprintf(), vsnprintf_do_pointer_kernel(), and x86_cpu_setup_xsave_area().
const char* name |
Definition at line 35 of file slab.cpp.
Referenced by acpi_sysfs_item_t::acpi_sysfs_item_t(), console_get(), cpio_i_iterate_dir(), create_thread(), dentry_create(), dentry_dump_refstat(), dentry_get_from_parent(), dentry_lookup_child(), dentry_name(), dirter_add(), dt_property::dt_property(), dump_fdt_node(), fdt_add_property_(), fdt_add_subnode(), fdt_add_subnode_namelen(), fdt_appendprop(), fdt_appendprop_addrrange(), fdt_appendprop_cell(), fdt_appendprop_u32(), fdt_appendprop_u64(), fdt_begin_node(), fdt_cells(), fdt_delprop(), fdt_get_alias(), fdt_get_alias_namelen(), fdt_get_path(), fdt_get_property(), fdt_get_property_namelen(), fdt_get_property_namelen_(), fdt_get_property_w(), fdt_getprop(), fdt_getprop_by_offset(), fdt_getprop_namelen(), fdt_getprop_namelen_w(), fdt_getprop_w(), fdt_nop_property(), fdt_property(), fdt_property_cell(), fdt_property_placeholder(), fdt_property_u32(), fdt_property_u64(), fdt_resize_property_(), fdt_set_name(), fdt_setprop(), fdt_setprop_cell(), fdt_setprop_inplace(), fdt_setprop_inplace_cell(), fdt_setprop_inplace_namelen_partial(), fdt_setprop_inplace_u32(), fdt_setprop_inplace_u64(), fdt_setprop_placeholder(), fdt_setprop_u32(), fdt_setprop_u64(), fdt_subnode_offset(), fdt_subnode_offset_namelen(), get_path_len(), dt_node::get_property(), dt_node::has_property(), impl_syscall_create_thread(), impl_syscall_ipc_connect(), impl_syscall_ipc_create(), impl_syscall_memfd_create(), impl_syscall_thread_setname(), ipc_connect(), ipc_connect_to_server(), ipc_create(), ipc_get_server(), ipc_server_create(), ipc_sysfs_lookup_ipc(), IPCDescriptor::IPCDescriptor(), kthread_create(), kthread_create_no_sched(), memfd_create(), memfd_create(), MOS_STATIC_ASSERT(), dt_node::operator[](), overlay_apply_node(), overlay_fixup_one_phandle(), overlay_fixup_phandle(), overlay_phandle_add_offset(), overlay_symbol_update(), overlay_update_local_node_references(), process_new(), riscv64_trap_handler(), slab_init(), slab_init_one(), start_thread(), start_thread(), syscall_create_thread(), syscall_ipc_connect(), syscall_ipc_create(), syscall_memfd_create(), syscall_thread_setname(), thread_new(), userfs_iop_hardlink(), userfs_iop_iterate_dir(), userfs_iop_lookup(), userfs_iop_mkdir(), userfs_iop_mknode(), userfs_iop_newfile(), userfs_iop_readlink(), userfs_iop_rmdir(), userfs_iop_symlink(), userfs_iop_unlink(), vfs_find_filesystem(), x86_cpu_setup_xsave_area(), and x86_handle_exception().
const struct { ... } BUILTIN_SLAB_SIZES[] |
Referenced by slab_init().
|
static |
Definition at line 43 of file slab.cpp.
Referenced by slab_for(), and slab_init().
|
static |
Definition at line 44 of file slab.cpp.
Referenced by slab_init_one(), slab_register(), and slab_sysfs_slabinfo().