bionic: Set PTHREAD_STACK_MIN for page agnostic targets
Page size agnostic targets will have a pthread stack equals
to 65536. Page size agnostic targets will only support ARM64 arch.
For not agnostic builds, PTHREAD_STACK_MIN will remain the same.
Bug: 296907948
Test: source build/envsetup.sh
lunch aosp_cf_arm64_phone_pgagnostic
m
source build/envsetup.sh
aosp_cf_x86_64_phone-userdebug
m
Change-Id: Ifcc04a9d924501f686cdfec34428d3f29154fdf0
diff --git a/libc/include/pthread.h b/libc/include/pthread.h
index 1f08628..4feade5 100644
--- a/libc/include/pthread.h
+++ b/libc/include/pthread.h
@@ -34,6 +34,7 @@
*/
#include <limits.h>
+#include <bits/page_size.h>
#include <bits/pthread_types.h>
#include <sched.h>
#include <sys/cdefs.h>
@@ -73,9 +74,14 @@
#define PTHREAD_BARRIER_SERIAL_THREAD (-1)
#endif
+
#if defined(__LP64__)
+#if defined(PAGE_SIZE)
#define PTHREAD_STACK_MIN (4 * PAGE_SIZE)
#else
+#define PTHREAD_STACK_MIN 65536
+#endif
+#else
#define PTHREAD_STACK_MIN (2 * PAGE_SIZE)
#endif