-
Notifications
You must be signed in to change notification settings - Fork 7.2k
posix: options: don't imply POSIX_MESSAGE_PASSING
#88538
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
base: main
Are you sure you want to change the base?
Conversation
Don't `imply POSIX_MESSAGE_PASSING` when `POSIX_API=y` as this option has a non-trivial RAM implication in `HEAP_MEM_POOL_ADD_SIZE_MQUEUE`. The `mq_*` API is minimally used in-tree, with all users already enabling the symbol directly. Signed-off-by: Jordan Yates <[email protected]>
`pthread_setspecific` requires a stack in order to allocate the `struct pthread_key_data` data structure. On 64 bit systems this data structure is 32 bytes, resulting in 160 bytes usage for the default 5 supported threads. Signed-off-by: Jordan Yates <[email protected]>
Looking into this a bit more, should
|
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.
Looks good to me.
Actually, the "default number of things" that we have do not necessarily need to align with the POSIX spec (by default). That's the nice thing about them being made configurable. As long as the config system, feature macro system, sysconf, etc, are able to change and convey what the value is, the application can make an informed decision. If something needs to be to spec, it can be.
So the heap-add by message passing as well as the heap-add by pthreads can even be further reduced by reducing the default number of things (just in general, not needed in this pr of course). Just saying a lot of this is ripe for space optimization.
Since the message passing option has been linked to the correct option group (xsi realtime), and since many other deprecated symbols are now gone (e.g. non-standard pthread IPC), it makes sense to remove it from POSIX API (which can be repurposed as since it is non-standard).
Thanks - it's a definite improvement
That's exactly the point - it was this blanket, non-standard option that just kept growing, and was basically around to support deprecated options that are now gone. AFAIR, also most in-tree usage of POSIX_API should be removed or easily replaceable now with better choices. Can choice options can depend on regular options? As far as AEP choices go, why don't we create another AEP choice that selects only POSIX_LIBC_EXT (which Zephyr has already chosen to use by default), and then make that the default AEP choice? |
Right now,
Yes? Although I'm not sure what sort of option construction you are thinking of.
I know almost nothing about the posix specification and what makes sense from that perspective, if you think its a good idea then sure. |
POSIX_C_LANG_SUPPORT_R is also chosen to be used by default in Zephyr, so that would be a part of whatever goes into the new AEP default choice. However, C lang r is incorrectly lumped in to _POSIX_THREAD_SAFE_FUNCTIONS right now, which is an Option rather than an Option Group. It needs to be broken up. Luckily, most of the work to correct that has already been done in #83368 . |
We should make that a separate Kconfig option, since it mainly relates to build options.
I was under the impression that they couldn't. Or maybe it's just that choice symbols can't be selected by options. Either way, I think reducing the creep of POSIX options is pretty feasible shortly, and it can be done in a standards-friendly way. |
I've done a test PR of removing all the defaults features enabled to see how much breaks: #88541 |
Don't
imply POSIX_MESSAGE_PASSING
whenPOSIX_API=y
as this option has a non-trivial RAM implication inHEAP_MEM_POOL_ADD_SIZE_MQUEUE
.The
mq_*
API is minimally used in-tree, with all users already enabling the symbol directly.POSIX_API
is selected byWIFI_NM_WPA_SUPPLICANT
, and since the Wi-Fi supplicant users are huge RAM hogs, any savings are appreciated.