Repository navigation
fs/mqueue: change default FS_MQUEUE_NPOLLWAITERS to 2 - #22445
Merged
GUIDINGLI merged 1 commit intoNov 27, 2026
Merged
Conversation
In fs/mqueue/Kconfig, CONFIG_FS_MQUEUE_NPOLLWAITERS currently defaults to 4, which was introduced when poll support was added in PR apache#2957. Each POSIX message queue pre-allocates an array of poll descriptors (FAR struct pollfd_s *fds[CONFIG_FS_MQUEUE_NPOLLWAITERS]) inside struct mqueue_inode_s. When mq_open() creates a queue, this structure is dynamically allocated from the heap. In typical embedded and RTOS applications, a message queue has at most one reader and one writer waiting concurrently on poll/select/epoll events. This change sets the default of CONFIG_FS_MQUEUE_NPOLLWAITERS to 2, aligning it with the rest of the IPC poll waiter configurations: CONFIG_SERIAL_NPOLLWAITERS=2 (PR apache#22228), CONFIG_DEV_PIPE_NPOLLWAITERS=2 (PR apache#22348), CONFIG_EVENT_FD_NPOLLWAITERS=2, CONFIG_TIMER_FD_NPOLLWAITERS=2, CONFIG_SIGNAL_FD_NPOLLWAITERS=2, and CONFIG_FS_NOTIFY_FD_POLLWAITERS=2. This saves 8 bytes of heap memory per message queue on 32-bit targets (16 bytes on 64-bit targets). Assisted-by: Claude:claude-opus-4.6 Signed-off-by: Swatantra Yadav <[email protected]>
Swatantra-66
requested review from
GUIDINGLI,
hartmannathan and
xiaoxiang781216
as code owners
November 26, 2026 19:06
|
xiaoxiang781216
approved these changes
Nov 27, 2026
GUIDINGLI
approved these changes
Nov 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Addresses Issue #20414
In fs/mqueue/Kconfig, CONFIG_FS_MQUEUE_NPOLLWAITERS currently defaults to 4, which was originally introduced when poll support was added to message queues (PR #2957).
Each POSIX message queue allocates an array of poll descriptors sized by CONFIG_FS_MQUEUE_NPOLLWAITERS:
When mq_open() creates a message queue, struct mqueue_inode_s is dynamically allocated from heap memory. In typical embedded and RTOS workloads, a message queue has at most one reader and one writer waiting simultaneously on poll/select/epoll events.
This change updates the default of CONFIG_FS_MQUEUE_NPOLLWAITERS from 4 to 2, aligning it with all other IPC and device poll waiter defaults across NuttX:
Applications requiring more than 2 concurrent poll waiters can still configure CONFIG_FS_MQUEUE_NPOLLWAITERS to a larger value via Kconfig.
Impact
Testing
Before and After Comparison
Verification Logs
Small profile configuration (stm32f103-minimum:nsh):
Standard profile configuration (sam4s-xplained-pro:nsh):
Code style check: