Skip to content

Commit 013978e

Browse files
authored
Zend/fibers: Ensure fiber stack is not backed by THP. (#13306)
Ending with fiber stack mapped in hugepages will affect performance badly. Until < Linux 6.8-rc2 MAP_STACK was a noop, now it implies no THP, older releases need madvise.
1 parent 4d17260 commit 013978e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Zend/zend_fibers.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,12 @@ static zend_fiber_stack *zend_fiber_stack_allocate(size_t size)
244244
return NULL;
245245
}
246246

247+
#if defined(MADV_NOHUGEPAGE)
248+
/* Multiple reasons to fail, ignore all errors only needed
249+
* for linux < 6.8 */
250+
(void) madvise(pointer, alloc_size, MADV_NOHUGEPAGE);
251+
#endif
252+
247253
zend_mmap_set_name(pointer, alloc_size, "zend_fiber_stack");
248254

249255
# if ZEND_FIBER_GUARD_PAGES

0 commit comments

Comments
 (0)