diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2019-02-18 14:04:15 +0100 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2019-02-18 14:04:15 +0100 |
commit | 3b3fafa637914d59c5588d72ddd0f6016642be0a (patch) | |
tree | 2b1485b876f8bb966e40cf2d0a7e9c5ce40d13c7 | |
parent | 767fa3dc02f39b64015539d9948874947cf20d5d (diff) | |
parent | 928c42211f737640e4dc3c9702ba833c3059bddf (diff) | |
download | php-git-3b3fafa637914d59c5588d72ddd0f6016642be0a.tar.gz |
Merge branch 'PHP-7.2' into PHP-7.3
-rw-r--r-- | Zend/zend_alloc.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c index 0039228d51..11f5b46bd9 100644 --- a/Zend/zend_alloc.c +++ b/Zend/zend_alloc.c @@ -191,9 +191,7 @@ typedef struct _zend_mm_free_slot zend_mm_free_slot; typedef struct _zend_mm_chunk zend_mm_chunk; typedef struct _zend_mm_huge_list zend_mm_huge_list; -#ifdef MAP_HUGETLB int zend_mm_use_huge_pages = 0; -#endif /* * Memory is retrived from OS by chunks of fixed size 2MB. @@ -714,7 +712,9 @@ static void *zend_mm_chunk_alloc_int(size_t size, size_t alignment) return NULL; } else if (ZEND_MM_ALIGNED_OFFSET(ptr, alignment) == 0) { #ifdef MADV_HUGEPAGE - madvise(ptr, size, MADV_HUGEPAGE); + if (zend_mm_use_huge_pages) { + madvise(ptr, size, MADV_HUGEPAGE); + } #endif return ptr; } else { @@ -745,7 +745,9 @@ static void *zend_mm_chunk_alloc_int(size_t size, size_t alignment) zend_mm_munmap((char*)ptr + size, alignment - REAL_PAGE_SIZE); } # ifdef MADV_HUGEPAGE - madvise(ptr, size, MADV_HUGEPAGE); + if (zend_mm_use_huge_pages) { + madvise(ptr, size, MADV_HUGEPAGE); + } # endif #endif return ptr; @@ -2668,9 +2670,7 @@ ZEND_API void shutdown_memory_manager(int silent, int full_shutdown) static void alloc_globals_ctor(zend_alloc_globals *alloc_globals) { -#if ZEND_MM_CUSTOM || MAP_HUGETLB char *tmp; -#endif #if ZEND_MM_CUSTOM tmp = getenv("USE_ZEND_ALLOC"); @@ -2684,12 +2684,11 @@ static void alloc_globals_ctor(zend_alloc_globals *alloc_globals) return; } #endif -#ifdef MAP_HUGETLB + tmp = getenv("USE_ZEND_ALLOC_HUGE_PAGES"); if (tmp && zend_atoi(tmp, 0)) { zend_mm_use_huge_pages = 1; } -#endif ZEND_TSRMLS_CACHE_UPDATE(); alloc_globals->mm_heap = zend_mm_init(); } |