Skip to content

zend_alloc little performance boost on illumos for large pages. #5800

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions Zend/zend_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -668,10 +668,18 @@ static void *zend_mm_chunk_alloc_int(size_t size, size_t alignment)
if (ptr == NULL) {
return NULL;
} else if (ZEND_MM_ALIGNED_OFFSET(ptr, alignment) == 0) {
#ifdef MADV_HUGEPAGE
#if defined(MADV_HUGEPAGE)
if (zend_mm_use_huge_pages) {
madvise(ptr, size, MADV_HUGEPAGE);
}
#elif defined(__sun)
if (zend_mm_use_huge_pages) {
struct memcntl_mha m;
m.mha_cmd = MHA_MAPSIZE_VA;
m.mha_pagesize = ZEND_MM_CHUNK_SIZE;
m.mha_flags = 0;
(void)memcntl(ptr, size, MC_HAT_ADVISE, (caddr_t)&m, 0, 0);
}
#endif
return ptr;
} else {
Expand Down Expand Up @@ -701,10 +709,18 @@ static void *zend_mm_chunk_alloc_int(size_t size, size_t alignment)
if (alignment > REAL_PAGE_SIZE) {
zend_mm_munmap((char*)ptr + size, alignment - REAL_PAGE_SIZE);
}
# ifdef MADV_HUGEPAGE
# if defined(MADV_HUGEPAGE)
if (zend_mm_use_huge_pages) {
madvise(ptr, size, MADV_HUGEPAGE);
}
# elif defined(__sun)
if (zend_mm_use_huge_pages) {
struct memcntl_mha m;
m.mha_cmd = MHA_MAPSIZE_VA;
m.mha_pagesize = ZEND_MM_CHUNK_SIZE;
m.mha_flags = 0;
(void)memcntl(ptr, size, MC_HAT_ADVISE, (caddr_t)&m, 0, 0);
}
# endif
#endif
return ptr;
Expand Down