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:
Ingo Weinhold
2010-01-21 23:10:52 +00:00
parent 5f679d1cd3
commit 86c794e5c1
28 changed files with 1111 additions and 420 deletions
+7 -2
View File
@@ -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();