slab allocator:
* Implemented a more elaborated raw memory allocation backend (MemoryManager). We allocate 8 MB areas whose pages we allocate and map when needed. An area is divided into equally-sized chunks which form the basic units of allocation. We have areas with three possible chunk sizes (small, medium, large), which is basically what the ObjectCache implementations were using anyway. * Added "uint32 flags" parameter to several of the slab allocator's object cache and object depot functions. E.g. object_depot_store() potentially wants to allocate memory for a magazine. But also in pure freeing functions it might eventually become useful to have those flags, since they could end up deleting an area, which might not be allowable in all situations. We should introduce specific flags to indicate that. * Reworked the block allocator. Since the MemoryManager allocates block-aligned areas, maintains a hash table for lookup, and maps chunks to object caches, we can quickly find out which object cache a to be freed allocation belongs to and thus don't need the boundary tags anymore. * Reworked the slab boot strap process. We allocate from the initial area only when really necessary, i.e. when the object cache for the respective allocation size has not been created yet. A single page is thus sufficient. other: * vm_allocate_early(): Added boolean "blockAlign" parameter. If true, the semantics is the same as for B_ANY_KERNEL_BLOCK_ADDRESS. * Use an object cache for page mappings. This significantly reduces the contention on the heap bin locks. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35232 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -23,7 +23,7 @@ typedef struct object_depot {
|
||||
|
||||
void* cookie;
|
||||
void (*return_object)(struct object_depot* depot, void* cookie,
|
||||
void* object);
|
||||
void* object, uint32 flags);
|
||||
} object_depot;
|
||||
|
||||
|
||||
@@ -32,13 +32,14 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
status_t object_depot_init(object_depot* depot, uint32 flags, void* cookie,
|
||||
void (*returnObject)(object_depot* depot, void* cookie, void* object));
|
||||
void object_depot_destroy(object_depot* depot);
|
||||
void (*returnObject)(object_depot* depot, void* cookie, void* object,
|
||||
uint32 flags));
|
||||
void object_depot_destroy(object_depot* depot, uint32 flags);
|
||||
|
||||
void* object_depot_obtain(object_depot* depot);
|
||||
int object_depot_store(object_depot* depot, void* object);
|
||||
int object_depot_store(object_depot* depot, void* object, uint32 flags);
|
||||
|
||||
void object_depot_make_empty(object_depot* depot);
|
||||
void object_depot_make_empty(object_depot* depot, uint32 flags);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ status_t object_cache_set_minimum_reserve(object_cache* cache,
|
||||
size_t objectCount);
|
||||
|
||||
void* object_cache_alloc(object_cache* cache, uint32 flags);
|
||||
void object_cache_free(object_cache* cache, void* object);
|
||||
void object_cache_free(object_cache* cache, void* object, uint32 flags);
|
||||
|
||||
status_t object_cache_reserve(object_cache* cache, size_t object_count,
|
||||
uint32 flags);
|
||||
|
||||
@@ -16,8 +16,9 @@
|
||||
|
||||
struct iovec;
|
||||
struct kernel_args;
|
||||
struct team;
|
||||
struct ObjectCache;
|
||||
struct system_memory_info;
|
||||
struct team;
|
||||
struct VMAddressSpace;
|
||||
struct VMArea;
|
||||
struct VMCache;
|
||||
@@ -31,6 +32,9 @@ struct vnode;
|
||||
#define CREATE_AREA_DONT_CLEAR 0x04
|
||||
|
||||
|
||||
extern struct ObjectCache* gPageMappingsObjectCache;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -43,10 +47,11 @@ status_t vm_init_post_modules(struct kernel_args *args);
|
||||
void vm_free_kernel_args(struct kernel_args *args);
|
||||
void vm_free_unused_boot_loader_range(addr_t start, addr_t end);
|
||||
addr_t vm_allocate_early(struct kernel_args *args, size_t virtualSize,
|
||||
size_t physicalSize, uint32 attributes);
|
||||
size_t physicalSize, uint32 attributes, bool blockAlign);
|
||||
|
||||
void slab_init(struct kernel_args *args, addr_t initialBase,
|
||||
size_t initialSize);
|
||||
void slab_init_post_area();
|
||||
void slab_init_post_sem();
|
||||
void slab_init_post_thread();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user