From ac16755e107495e97f32fbc049ee2600ba79694a Mon Sep 17 00:00:00 2001 From: Avi Kivity <avi.kivity@gmail.com> Date: Fri, 28 Dec 2012 14:46:03 +0200 Subject: [PATCH] mempool: compute pool count instead of hardcoding it --- mempool.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mempool.cc b/mempool.cc index fddfc1c34..3483cfdf8 100644 --- a/mempool.cc +++ b/mempool.cc @@ -1,4 +1,5 @@ #include "mempool.hh" +#include "ilog2.hh" #include <cassert> #include <cstdint> #include <new> @@ -89,8 +90,8 @@ pool* pool::from_object(void* object) return header->owner; } -// FIXME: compute 12 -malloc_pool malloc_pools[12] __attribute__((init_priority(12000))); +malloc_pool malloc_pools[ilog2_roundup_constexpr(page_size)] + __attribute__((init_priority(12000))); malloc_pool::malloc_pool() : pool(compute_object_size(this - malloc_pools)) -- GitLab