com php-src: Use regular huge pages instead of anonymous if available.: Zend/zend_alloc.c
| From: | Dmitry Stogov | Date: | Wed, 02 Sep 2015 12:55:41 +0000 |
| Subject: | com php-src: Use regular huge pages instead of anonymous if available.: Zend/zend_alloc.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-88856@lists.php.net to get a copy of this message | ||
Commit: 6848cb3f6301db11e1925f4457c0b58c2d169ccf
Author: Dmitry Stogov <dmitry@zend.com> Wed, 2 Sep 2015 15:55:41 +0300
Parents: 111bd5d8c45a9c44b2e39951e6a1a543a893f8bd
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=6848cb3f6301db11e1925f4457c0b58c2d169ccf
Log:
Use regular huge pages instead of anonymous if available.
Changed paths:
M Zend/zend_alloc.c
Diff:
diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c
index ced3a77..9e7f5d1 100644
--- a/Zend/zend_alloc.c
+++ b/Zend/zend_alloc.c
@@ -459,7 +459,18 @@ static void *zend_mm_mmap(size_t size)
}
return ptr;
#else
- void *ptr = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON /*| MAP_POPULATE |
MAP_HUGETLB*/, -1, 0);
+ void *ptr;
+
+#ifdef MAP_HUGETLB
+ if (size == ZEND_MM_CHUNK_SIZE) {
+ ptr = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON | MAP_HUGETLB, -1, 0);
+ if (ptr != MAP_FAILED) {
+ return ptr;
+ }
+ }
+#endif
+
+ ptr = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0);
if (ptr == MAP_FAILED) {
#if ZEND_MM_ERROR