summaryrefslogtreecommitdiff
path: root/src/modules/eina
diff options
context:
space:
mode:
authorCedric BAIL <cedric@efl.so>2013-11-10 09:26:12 +0100
committerCedric BAIL <cedric@efl.so>2013-11-10 09:26:12 +0100
commitda559ee5d0403b145a334c26c5cf9c45cf03f40f (patch)
treef83ca3831e76cfc88eedbae2d0cc8935f450d193 /src/modules/eina
parentecaca1d365b998b3e339b387897c0646b2b3556f (diff)
eina: use portable infrastructure to detect page size.
Diffstat (limited to 'src/modules/eina')
-rw-r--r--src/modules/eina/mp/chained_pool/eina_chained_mempool.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/modules/eina/mp/chained_pool/eina_chained_mempool.c b/src/modules/eina/mp/chained_pool/eina_chained_mempool.c
index b71b79dcf4..67e2e6a7cf 100644
--- a/src/modules/eina/mp/chained_pool/eina_chained_mempool.c
+++ b/src/modules/eina/mp/chained_pool/eina_chained_mempool.c
@@ -65,6 +65,7 @@ static int _eina_chained_mp_log_dom = -1;
65#endif 65#endif
66 66
67static int aligned_chained_pool = 0; 67static int aligned_chained_pool = 0;
68static int page_size = 0;
68 69
69typedef struct _Chained_Mempool Chained_Mempool; 70typedef struct _Chained_Mempool Chained_Mempool;
70struct _Chained_Mempool 71struct _Chained_Mempool
@@ -467,8 +468,8 @@ eina_chained_mempool_init(const char *context,
467 468
468 mp->item_alloc = eina_mempool_alignof(item_size); 469 mp->item_alloc = eina_mempool_alignof(item_size);
469 470
470 mp->pool_size = (((((mp->item_alloc * mp->pool_size + aligned_chained_pool) / 4096) 471 mp->pool_size = (((((mp->item_alloc * mp->pool_size + aligned_chained_pool) / page_size)
471 + 1) * 4096) 472 + 1) * page_size)
472 - aligned_chained_pool) / mp->item_alloc; 473 - aligned_chained_pool) / mp->item_alloc;
473 474
474#ifdef EINA_DEBUG_MALLOC 475#ifdef EINA_DEBUG_MALLOC
@@ -558,6 +559,7 @@ Eina_Bool chained_init(void)
558 559
559#endif 560#endif
560 aligned_chained_pool = eina_mempool_alignof(sizeof(Chained_Pool)); 561 aligned_chained_pool = eina_mempool_alignof(sizeof(Chained_Pool));
562 page_size = eina_cpu_page_size();
561 563
562 return eina_mempool_register(&_eina_chained_mp_backend); 564 return eina_mempool_register(&_eina_chained_mp_backend);
563} 565}