split out allocate_large function

pull/87/head
Daniel Micay 2019-04-07 05:30:07 -04:00
parent 3d18fb8074
commit ce36d0c826
1 changed files with 5 additions and 5 deletions

View File

@ -1127,11 +1127,7 @@ static size_t get_guard_size(struct random_state *state, size_t size) {
return (get_random_u64_uniform(state, size / PAGE_SIZE / GUARD_SIZE_DIVISOR) + 1) * PAGE_SIZE; return (get_random_u64_uniform(state, size / PAGE_SIZE / GUARD_SIZE_DIVISOR) + 1) * PAGE_SIZE;
} }
static void *allocate(size_t size) { static void *allocate_large(size_t size) {
if (size <= max_slab_size_class) {
return allocate_small(size);
}
struct region_allocator *ra = ro.region_allocator; struct region_allocator *ra = ro.region_allocator;
mutex_lock(&ra->lock); mutex_lock(&ra->lock);
@ -1157,6 +1153,10 @@ static void *allocate(size_t size) {
return p; return p;
} }
static inline void *allocate(size_t size) {
return size <= max_slab_size_class ? allocate_small(size) : allocate_large(size);
}
static void deallocate_large(void *p, const size_t *expected_size) { static void deallocate_large(void *p, const size_t *expected_size) {
enforce_init(); enforce_init();
thread_unseal_metadata(); thread_unseal_metadata();