From 1efcdaf092a8e26342b67f2c7765be25dd459b4b Mon Sep 17 00:00:00 2001 From: Rasmus Lerdorf Date: Tue, 22 Mar 2016 08:04:53 -0700 Subject: [PATCH 1/2] Disable huge pages in the Zend allocator by default As per the discussion on internals, this is an expert feature that needs special system-level configuration and care. --- NEWS | 9 +++++---- Zend/zend_alloc.c | 6 +++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/NEWS b/NEWS index 8f32f466822..98407303239 100644 --- a/NEWS +++ b/NEWS @@ -2,9 +2,10 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? 2016 PHP 7.0.6 -- Core: - . Added ability to disable huge pages in Zend Memory Manager through - the environment variable USE_ZEND_ALLOC_HUGE_PAGES=0. (Dmitry) +- Core: + . Huge pages disabled by default. (Rasmus) + . Added ability to enable huge pages in Zend Memory Manager through + the environment variable USE_ZEND_ALLOC_HUGE_PAGES=1. (Dmitry) . Fixed Bug #71859 (zend_objects_store_call_destructors operates on realloced memory, crashing). (Laruence) . Fixed bug #71841 (EG(error_zval) is not handled well). (Laruence) @@ -18,7 +19,7 @@ PHP NEWS - Curl: . Fixed bug #71831 (CURLOPT_NOPROXY applied as long instead of string). - (Michael Sierks) + (Michael Sierks) - ODBC: . Fixed bug #63171 (Script hangs after max_execution_time). (Remi) diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c index 4cf1178c570..18765593174 100644 --- a/Zend/zend_alloc.c +++ b/Zend/zend_alloc.c @@ -201,7 +201,7 @@ typedef struct _zend_mm_huge_list zend_mm_huge_list; #endif #ifdef MAP_HUGETLB -int zend_mm_use_huge_pages = 1; +int zend_mm_use_huge_pages = 0; #endif /* @@ -2654,8 +2654,8 @@ static void alloc_globals_ctor(zend_alloc_globals *alloc_globals) #endif #ifdef MAP_HUGETLB tmp = getenv("USE_ZEND_ALLOC_HUGE_PAGES"); - if (tmp && !zend_atoi(tmp, 0)) { - zend_mm_use_huge_pages = 0; + if (tmp && zend_atoi(tmp, 0)) { + zend_mm_use_huge_pages = 1; } #endif ZEND_TSRMLS_CACHE_UPDATE(); From 241ba9dcb195160e323847757413603a3cc72a1f Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Tue, 22 Mar 2016 21:41:35 +0100 Subject: [PATCH 2/2] if there's no JIT support, no RINIT is really needed --- ext/pcre/php_pcre.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c index 24ed6ca5d63..f6f86304e5e 100644 --- a/ext/pcre/php_pcre.c +++ b/ext/pcre/php_pcre.c @@ -212,18 +212,18 @@ static PHP_MSHUTDOWN_FUNCTION(pcre) } /* }}} */ +#ifdef PCRE_STUDY_JIT_COMPILE /* {{{ PHP_RINIT_FUNCTION(pcre) */ static PHP_RINIT_FUNCTION(pcre) { -#ifdef PCRE_STUDY_JIT_COMPILE if (PCRE_G(jit)) { jit_stack = pcre_jit_stack_alloc(PCRE_JIT_STACK_MIN_SIZE,PCRE_JIT_STACK_MAX_SIZE); } -#endif return SUCCESS; } /* }}} */ +#endif /* {{{ static pcre_clean_cache */ static int pcre_clean_cache(zval *data, void *arg) @@ -2232,7 +2232,11 @@ zend_module_entry pcre_module_entry = { pcre_functions, PHP_MINIT(pcre), PHP_MSHUTDOWN(pcre), +#ifdef PCRE_STUDY_JIT_COMPILE PHP_RINIT(pcre), +#else + NULL +#endif NULL, PHP_MINFO(pcre), PHP_PCRE_VERSION,