MOS Source Code
|
#include "mos/mm/slab.h"
#include "mos/filesystem/sysfs/sysfs.h"
#include "mos/misc/setup.h"
#include "mos/mm/mm.h"
#include "mos/syslog/printk.h"
#include <mos/lib/structures/list.h>
#include <mos/lib/sync/spinlock.h>
#include <mos/mos_global.h>
#include <mos_stdlib.h>
#include <mos_string.h>
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_init_one (slab_t *slab, const char *name, size_t size) |
static void | slab_allocate_mem (slab_t *slab) |
static void | slab_init (void) |
MOS_INIT (POST_MM, slab_init) | |
static void | kmemcache_free (slab_t *slab, const void *addr) |
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. | |
slab_t * | kmemcache_create (const char *name, size_t ent_size) |
void * | kmemcache_alloc (slab_t *slab) |
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 | slab_slab = { 0 } | |
static slab_t | slabs [MOS_ARRAY_SIZE(BUILTIN_SLAB_SIZES)] = { 0 } | |
static list_head | slabs_list = LIST_HEAD_INIT(slabs_list) | |
Definition at line 46 of file slab.c.
Referenced by slab_alloc().
Definition at line 57 of file slab.c.
Referenced by slab_alloc(), and slab_allocate_mem().
Definition at line 64 of file slab.c.
Referenced by slab_free().
Definition at line 70 of file slab.c.
Referenced by kmemcache_create(), and slab_init().
Definition at line 83 of file slab.c.
Referenced by kmemcache_alloc(), kmemcache_create(), and slab_init().
MOS_INIT | ( | POST_MM | , |
slab_init | ) |
Definition at line 252 of file slab.c.
Referenced by slab_free(), and slab_realloc().
Allocate a block of memory from the slab allocator.
size |
Definition at line 130 of file slab.c.
Referenced by operator new(), operator new[](), slab_calloc(), and slab_realloc().
Free a block of memory from the slab allocator.
addr |
Definition at line 200 of file slab.c.
Referenced by slab_realloc().
Definition at line 219 of file slab.c.
Referenced by setup_xsave_slab().
Definition at line 227 of file slab.c.
Referenced by kmemcache_create(), and slab_alloc().
|
static |
Definition at line 270 of file slab.c.
Referenced by MOS_INIT().
MOS_INIT | ( | SYSFS | , |
slab_sysfs_init | ) |
size_t size |
Definition at line 30 of file slab.c.
Referenced by _null_read(), _null_write(), acpi_find_rsdp(), bitmap_create(), check_block_(), console_io_read(), console_io_write(), console_write(), console_write_color(), decode_callback_field(), decode_pointer_field(), decode_static_field(), dentry_path(), dmabuf_share(), dmabuf_share(), dmabuf_unshare(), dmabuf_unshare(), 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(), free_with_check(), initrd_read(), 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(), operator new(), operator new[](), 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_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(), 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_do_pointer_kernel(), and x86_cpu_setup_xsave_area().
const char* name |
Definition at line 31 of file slab.c.
Referenced by console_get(), cpio_i_iterate_dir(), create_thread(), dentry_create(), dentry_get_from_parent(), dentry_lookup_child(), 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(), ipc_connect(), ipc_connect_to_server(), ipc_create(), ipc_get_server(), ipc_server_create(), ipc_sysfs_lookup_ipc(), kmemcache_create(), 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_allocate(), process_new(), riscv64_trap_handler(), slab_init(), slab_init_one(), start_thread(), syscall_create_thread(), syscall_ipc_connect(), syscall_ipc_create(), syscall_memfd_create(), syscall_thread_setname(), thread_new(), 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 41 of file slab.c.
Referenced by kmemcache_create(), and slab_init().
|
static |
Definition at line 43 of file slab.c.
Referenced by slab_for(), and slab_init().
|
static |
Definition at line 44 of file slab.c.
Referenced by slab_init_one(), and slab_sysfs_slabinfo().