apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yann Ylavic <ylavic....@gmail.com>
Subject Allocator nodes of a single page
Date Fri, 24 Feb 2017 17:06:25 GMT
Hello,

the attached patch modifies the allocator (and pool) to allow for
order-0 nodes/allocations (2^0, one page, 4K on most CPUs).

The pools are still created with order-1 (two pages) by default, but
one can use the new apr_pool_order_set(order) function at any time
(preferable init time) to default to different order (max 9).

This change requires to recycle single pages in slot 0
(allocator->free[0]) and thus to move the sink slot at MAX_INDEX (for
non-fitting nodes).

Also, since the page is now relevant outside APR_ALLOCATOR_USES_MMAP
scope, _SC_PAGESIZE is always determined at init time and gives
dynamic BOUNDARY_INDEX/BOUNDARY_SIZE for runtime (only when
_SC_PAGESIZE is defined still, otherwise 4K is the default).

Pros/cons?


Regards,
Yann.

Mime
View raw message