diff --git a/thread_pthread_mn.c b/thread_pthread_mn.c index 64266683cdb452..b310a1c0cf59cf 100644 --- a/thread_pthread_mn.c +++ b/thread_pthread_mn.c @@ -116,8 +116,19 @@ thread_sched_wait_events(struct rb_thread_sched *sched, rb_thread_t *th, int fd, /// stack management +static long +get_sysconf_page_size(void) +{ + static long page_size = 0; + + if (UNLIKELY(page_size == 0)) { + page_size = sysconf(_SC_PAGESIZE); + } + return page_size; +} + #define MSTACK_CHUNK_SIZE (512 * 1024 * 1024) // 512MB -#define MSTACK_PAGE_SIZE 4096 +#define MSTACK_PAGE_SIZE get_sysconf_page_size() #define MSTACK_CHUNK_PAGE_NUM (MSTACK_CHUNK_SIZE / MSTACK_PAGE_SIZE - 1) // 1 is start redzone // 512MB chunk