This is an automated email from the ASF dual-hosted git repository.

GUIDINGLI pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new ed089279a24 drivers/pipes: change default DEV_PIPE_NPOLLWAITERS to 2
ed089279a24 is described below

commit ed089279a24458cfd1f61f3bae9d3652f675a204
Author: Swatantra Yadav <[email protected]>
AuthorDate: Thu Nov 26 01:30:02 2026 +0530

    drivers/pipes: change default DEV_PIPE_NPOLLWAITERS to 2
    
    Change CONFIG_DEV_PIPE_NPOLLWAITERS default from 4 to 2 across all
    configurations. Pipe, FIFO, and Unix domain stream sockets rarely
    have more than two threads simultaneously polling or waiting on the
    same descriptor.
    
    Each pipe/FIFO allocates an array of poll descriptor pointers
    (FAR struct pollfd_s *d_fds[CONFIG_DEV_PIPE_NPOLLWAITERS]) in
    struct pipe_dev_s, and Unix domain stream sockets allocate
    struct local_pollfd_s stream[CONFIG_DEV_PIPE_NPOLLWAITERS] in
    struct local_conn_s.
    
    Changing CONFIG_DEV_PIPE_NPOLLWAITERS to default to 2 reduces dynamic
    heap allocations across all configurations:
    - Saves 8 bytes per pipe/FIFO on 32-bit (16 bytes on 64-bit).
    - Saves 112 bytes per local stream socket on 32-bit (192 bytes on 64-bit).
    - Matches the fallback in drivers/pipes/pipe_common.h
      (#define CONFIG_DEV_PIPE_NPOLLWAITERS 2) and aligns with
      SERIAL_NPOLLWAITERS=2, EVENT_FD_NPOLLWAITERS=2, and
      TIMER_FD_NPOLLWAITERS=2.
    
    Also document pipe driver configuration options in
    Documentation/os/drivers/special/pipes.rst.
    
    Assisted-by: Claude:claude-opus-4.6
    Signed-off-by: Swatantra Yadav <[email protected]>
---
 Documentation/os/drivers/special/pipes.rst | 12 ++++++++++++
 drivers/pipes/Kconfig                      |  2 +-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/Documentation/os/drivers/special/pipes.rst 
b/Documentation/os/drivers/special/pipes.rst
index 878e8e16257..12d25f708de 100644
--- a/Documentation/os/drivers/special/pipes.rst
+++ b/Documentation/os/drivers/special/pipes.rst
@@ -1,3 +1,15 @@
 ===========================
 FIFO and named pipe drivers
 ===========================
+
+Configuration
+=============
+
+- ``CONFIG_PIPES``: Enables FIFO and named pipe drivers.
+- ``CONFIG_DEV_PIPE_SIZE``: Sets the default size of the pipe ringbuffer in
+  bytes (defaults to 1024, or 256 on ``CONFIG_DEFAULT_SMALL=y``).
+- ``CONFIG_DEV_FIFO_SIZE``: Sets the default size of the FIFO ringbuffer in
+  bytes (defaults to 1024, or 256 on ``CONFIG_DEFAULT_SMALL=y``).
+- ``CONFIG_DEV_PIPE_NPOLLWAITERS``: Maximum number of threads that can wait
+  for POLL events on a pipe, FIFO, or local domain socket. Defaults to 2 to
+  minimize dynamic memory overhead.
diff --git a/drivers/pipes/Kconfig b/drivers/pipes/Kconfig
index 4d497f4e6bc..25b466b8770 100644
--- a/drivers/pipes/Kconfig
+++ b/drivers/pipes/Kconfig
@@ -63,7 +63,7 @@ config DEV_PIPE_VFS_PATH
 
 config DEV_PIPE_NPOLLWAITERS
        int "number of threads for waiting POLL events"
-       default 4
+       default 2
        ---help---
                Maximum number of threads that can be waiting for POLL events
 

Reply via email to