mirror of
https://github.com/php/php-src.git
synced 2025-08-16 14:08:47 +02:00
Added ability to disable huge pages in Zend Memeory Manager through the environment variable USE_ZEND_ALLOC_HUGE_PAGES=0.
This commit is contained in:
parent
28b6f0232b
commit
945a661912
2 changed files with 13 additions and 1 deletions
2
NEWS
2
NEWS
|
@ -3,6 +3,8 @@ PHP NEWS
|
||||||
?? ??? 2016 PHP 7.0.6
|
?? ??? 2016 PHP 7.0.6
|
||||||
|
|
||||||
- Core:
|
- Core:
|
||||||
|
. Added ability to disable huge pages in Zend Memeory Manager through
|
||||||
|
the environment variable USE_ZEND_ALLOC_HUGE_PAGES=0. (Dmitry)
|
||||||
. Fixed bug #71841 (EG(error_zval) is not handled well). (Laruence)
|
. Fixed bug #71841 (EG(error_zval) is not handled well). (Laruence)
|
||||||
|
|
||||||
- ODBC:
|
- ODBC:
|
||||||
|
|
|
@ -200,6 +200,10 @@ typedef struct _zend_mm_huge_list zend_mm_huge_list;
|
||||||
# define PTR_FMT "0x%0.8lx"
|
# define PTR_FMT "0x%0.8lx"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef MAP_HUGETLB
|
||||||
|
int zend_mm_use_huge_pages = 1;
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Memory is retrived from OS by chunks of fixed size 2MB.
|
* Memory is retrived from OS by chunks of fixed size 2MB.
|
||||||
* Inside chunk it's managed by pages of fixed size 4096B.
|
* Inside chunk it's managed by pages of fixed size 4096B.
|
||||||
|
@ -462,7 +466,7 @@ static void *zend_mm_mmap(size_t size)
|
||||||
void *ptr;
|
void *ptr;
|
||||||
|
|
||||||
#ifdef MAP_HUGETLB
|
#ifdef MAP_HUGETLB
|
||||||
if (size == ZEND_MM_CHUNK_SIZE) {
|
if (zend_mm_use_huge_pages && size == ZEND_MM_CHUNK_SIZE) {
|
||||||
ptr = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON | MAP_HUGETLB, -1, 0);
|
ptr = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON | MAP_HUGETLB, -1, 0);
|
||||||
if (ptr != MAP_FAILED) {
|
if (ptr != MAP_FAILED) {
|
||||||
return ptr;
|
return ptr;
|
||||||
|
@ -2647,6 +2651,12 @@ static void alloc_globals_ctor(zend_alloc_globals *alloc_globals)
|
||||||
alloc_globals->mm_heap->custom_heap.std._realloc = realloc;
|
alloc_globals->mm_heap->custom_heap.std._realloc = realloc;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
#ifdef MAP_HUGETLB
|
||||||
|
tmp = getenv("USE_ZEND_ALLOC_HUGE_PAGES");
|
||||||
|
if (tmp && !zend_atoi(tmp, 0)) {
|
||||||
|
zend_mm_use_huge_pages = 0;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
ZEND_TSRMLS_CACHE_UPDATE();
|
ZEND_TSRMLS_CACHE_UPDATE();
|
||||||
alloc_globals->mm_heap = zend_mm_init();
|
alloc_globals->mm_heap = zend_mm_init();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue