]> git.proxmox.com Git - wasi-libc.git/blobdiff - libc-top-half/musl/src/thread/pthread_create.c
Reduce over-allocation of stack (#365)
[wasi-libc.git] / libc-top-half / musl / src / thread / pthread_create.c
index 3b3a2642e14d44c297365e536f4f3b97af128fad..1ac920f13c8ddc998551eeb7daf4e36b005269be 100644 (file)
@@ -295,7 +295,17 @@ _Noreturn void wasi_thread_start(int tid, void *p)
 }
 #endif
 
+#ifdef __wasilibc_unmodified_upstream
 #define ROUND(x) (((x)+PAGE_SIZE-1)&-PAGE_SIZE)
+#else
+/*
+ * As we allocate stack with malloc() instead of mmap/mprotect,
+ * there is no point to round it up to PAGE_SIZE.
+ * Instead, round up to a sane alignment.
+ * Note: PAGE_SIZE is rather big on WASM. (65536)
+ */
+#define ROUND(x) (((x)+16-1)&-16)
+#endif
 
 /* pthread_key_create.c overrides this */
 static volatile size_t dummy = 0;