diff options
author | Maria Matejka <mq@ucw.cz> | 2021-09-08 11:29:49 +0200 |
---|---|---|
committer | Maria Matejka <mq@ucw.cz> | 2021-10-13 19:01:22 +0200 |
commit | 6cd37713781a3092f8166b2178fae35cbfec1e28 (patch) | |
tree | d80aaadbbd0b39765f6284229420dea754618c45 /lib | |
parent | 3a31c3aad6c53ea9673743f983e13728d8551149 (diff) |
Multipage allocation
We can also quite simply allocate bigger blocks. Anyway, we need these
blocks to be aligned to their size which needs one mmap() two times
bigger and then two munmap()s returning the unaligned parts.
The user can specify -B <N> on startup when <N> is the exponent of 2,
setting the block size to 2^N. On most systems, N is 12, anyway if you
know that your configuration is going to eat gigabytes of RAM, you are
almost forced to raise your block size as you may easily get into memory
fragmentation issues or you have to raise your maximum mapping count,
e.g. "sysctl vm.max_map_count=(number)".
Diffstat (limited to 'lib')
-rw-r--r-- | lib/resource.c | 2 | ||||
-rw-r--r-- | lib/slab.c | 2 |
2 files changed, 1 insertions, 3 deletions
diff --git a/lib/resource.c b/lib/resource.c index 0ad886d9..e80b315b 100644 --- a/lib/resource.c +++ b/lib/resource.c @@ -61,7 +61,6 @@ pool root_pool; void *alloc_sys_page(void); void free_sys_page(void *); -void resource_sys_init(void); static int indent; @@ -283,7 +282,6 @@ rlookup(unsigned long a) void resource_init(void) { - resource_sys_init(); root_pool.r.class = &pool_class; root_pool.name = "Root"; init_list(&root_pool.inside); @@ -178,7 +178,7 @@ struct sl_alignment { /* Magic structure for testing of alignment */ int x[0]; }; -#define SL_GET_HEAD(x) ((struct sl_head *) (((uintptr_t) (x)) & ~(page_size-1))) +#define SL_GET_HEAD(x) ((struct sl_head *) PAGE_HEAD(x)) /** * sl_new - create a new Slab |