posix: pthread: support stack sizes larger than 65k
A previous size optimization capped the pthread_attr_t stacksize property at 65536. Some Zephyr users felt that was not large enough for specific use cases. Modify struct pthread_attr to support large stack sizes by default with the flexibility to allow users to vary the number of bits used for both stacksizes and guardsizes. The default guardsize remains zero sinze Zephyr's stack allocators already pad stacks with a guard area based on other config parameters, and since Zephyr is already designed to support both SW and HW stack protection at the kernel layer. Signed-off-by: Christopher Friedt <cfriedt@meta.com>
This commit is contained in:
parent
beb43bdf20
commit
fcd139d7af
4 changed files with 70 additions and 63 deletions
|
@ -27,9 +27,28 @@ config PTHREAD_RECYCLER_DELAY_MS
|
|||
Note: this option should be considered temporary and will likely be
|
||||
removed once a more synchronous solution is available.
|
||||
|
||||
config POSIX_PTHREAD_ATTR_STACKSIZE_BITS
|
||||
int "Significant bits for pthread_attr_t stacksize"
|
||||
range 8 31
|
||||
default 23
|
||||
help
|
||||
This value plays a part in determining the maximum supported
|
||||
pthread_attr_t stacksize. Valid stacksizes are in the range
|
||||
[1, N], where N = 1 << M, and M is this configuration value.
|
||||
|
||||
config POSIX_PTHREAD_ATTR_GUARDSIZE_BITS
|
||||
int "Significant bits for pthread_attr_t guardsize"
|
||||
range 1 31
|
||||
default 9
|
||||
help
|
||||
This value plays a part in determining the maximum supported
|
||||
pthread_attr_t guardsize. Valid guardsizes are in the range
|
||||
[0, N-1], where N = 1 << M, and M is this configuration value.
|
||||
|
||||
Actual guardsize values may be rounded-up.
|
||||
|
||||
config POSIX_PTHREAD_ATTR_GUARDSIZE_DEFAULT
|
||||
int "Default size of stack guard area"
|
||||
range 0 65536
|
||||
default 0
|
||||
help
|
||||
This is the default amount of space to reserve at the overflow end of a
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue