-
Notifications
You must be signed in to change notification settings - Fork 1.9k
coro: Extend coro stack for SIMD operated yyjson #11586
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -71,10 +71,16 @@ struct flb_coro { | |
| #define STACK_FACTOR 1 | ||
| #endif | ||
|
|
||
| #ifdef FLB_HAVE_SIMD | ||
| #define SIMD_STACK_FACTOR 2 /* Use bigger size for coro stacks with SIMD */ | ||
| #else | ||
| #define SIMD_STACK_FACTOR 1 /* no-op */ | ||
| #endif | ||
|
|
||
| #ifdef FLB_CORO_STACK_SIZE | ||
| #define FLB_CORO_STACK_SIZE_BYTE FLB_CORO_STACK_SIZE | ||
| #else | ||
| #define FLB_CORO_STACK_SIZE_BYTE ((3 * STACK_FACTOR * PTHREAD_STACK_MIN) / 2) | ||
| #define FLB_CORO_STACK_SIZE_BYTE ((3 * STACK_FACTOR * SIMD_STACK_FACTOR * PTHREAD_STACK_MIN) / 2) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Useful? React with 👍 / 👎. |
||
| #endif | ||
|
|
||
| #define FLB_CORO_DATA(coro) (((char *) coro) + sizeof(struct flb_coro)) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On musl-based builds
PTHREAD_STACK_MINis 2048, so this formula produces only 6144 bytes whenFLB_HAVE_SIMDis enabled. That is still far below the ~38 KiByyjson_read_opts()frame called out in the commit message, andconfig->coro_stack_sizeis initialized fromFLB_CORO_STACK_SIZE_BYTEinsrc/flb_config.c:394, so Alpine/musl packages will continue to hit the same coroutine overflow. Please clamp the SIMD path to a real byte floor instead of anotherPTHREAD_STACK_MINmultiple.Useful? React with 👍 / 👎.