]> granicus.if.org Git - php/commitdiff
Use regular huge pages instead of anonymous if available.
authorDmitry Stogov <dmitry@zend.com>
Wed, 2 Sep 2015 12:55:41 +0000 (15:55 +0300)
committerDmitry Stogov <dmitry@zend.com>
Wed, 2 Sep 2015 12:55:41 +0000 (15:55 +0300)
Zend/zend_alloc.c

index ced3a77d70da5f55f0724b8d7371ac4bc480c426..9e7f5d194b2551a9855997ae7f8a18b94baa870e 100644 (file)
@@ -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