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

xiaoxiang781216 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 557b79704c8 drivers/serial: change default SERIAL_NPOLLWAITERS to 2
557b79704c8 is described below

commit 557b79704c81aa8c86f704492495300ab436b9eb
Author: Swatantra Yadav <[email protected]>
AuthorDate: Mon Nov 23 23:20:17 2026 +0530

    drivers/serial: change default SERIAL_NPOLLWAITERS to 2
    
    Change CONFIG_SERIAL_NPOLLWAITERS default from 4 to 2 across all
    configurations. Most serial applications only poll stdin for POLLIN
    and do not require 4 simultaneous poll waiter slots. Reducing
    CONFIG_SERIAL_NPOLLWAITERS from 4 to 2 eliminates two pollfd pointer
    entries from struct uart_dev_s, saving 8 bytes of RAM per allocated
    serial port on 32-bit architectures (16 bytes on 64-bit architectures),
    and 16 bytes total on stm32f103-minimum:nsh.
    
    Also refresh existing board defconfigs where CONFIG_SERIAL_NPOLLWAITERS=2
    was explicitly set to avoid defconfig normalization warnings in CI.
    
    Assisted-by: Claude:claude-opus-4.6
    Signed-off-by: Swatantra Yadav <[email protected]>
---
 Documentation/os/drivers/character/serial.rst                       | 6 ++++++
 boards/arm64/imx9/imx93-evk/configs/knsh/defconfig                  | 1 -
 boards/arm64/imx9/imx93-evk/configs/koptee/defconfig                | 1 -
 boards/risc-v/mpfs/icicle/configs/hwtest/defconfig                  | 1 -
 boards/risc-v/mpfs/icicle/configs/knsh/defconfig                    | 1 -
 boards/risc-v/mpfs/icicle/configs/nsh/defconfig                     | 1 -
 boards/risc-v/mpfs/icicle/configs/opensbi/defconfig                 | 1 -
 boards/risc-v/mpfs/icicle/configs/pnsh/defconfig                    | 1 -
 boards/risc-v/mpfs/icicle/configs/rpmsg-sbi/defconfig               | 1 -
 boards/risc-v/mpfs/m100pfsevp/configs/nsh/defconfig                 | 1 -
 boards/xtensa/esp32/esp32-devkitc/configs/wamr_wasi_debug/defconfig | 1 -
 drivers/serial/Kconfig                                              | 4 ++--
 include/nuttx/serial/serial.h                                       | 2 +-
 13 files changed, 9 insertions(+), 13 deletions(-)

diff --git a/Documentation/os/drivers/character/serial.rst 
b/Documentation/os/drivers/character/serial.rst
index 4dedaa1cbaa..d344b5fb05f 100644
--- a/Documentation/os/drivers/character/serial.rst
+++ b/Documentation/os/drivers/character/serial.rst
@@ -92,6 +92,12 @@ Serial Device Drivers
    set to ``ENOTTY``), reducing code size on memory-constrained
    targets.
 
+-  **Poll waiters**. ``CONFIG_SERIAL_NPOLLWAITERS`` sets the maximum
+   number of threads that can wait simultaneously for ``POLLIN`` or
+   ``POLLOUT`` events on a serial device. The default is 2,
+   reducing the ``struct uart_dev_s`` waiter array size and saving
+   RAM across all platforms.
+
 -  **User Access**. Serial drivers are, ultimately, normal
    `character drivers <#chardrivers>`__ and are accessed as other
    character drivers.
diff --git a/boards/arm64/imx9/imx93-evk/configs/knsh/defconfig 
b/boards/arm64/imx9/imx93-evk/configs/knsh/defconfig
index e07a750eff6..4ef8235c391 100644
--- a/boards/arm64/imx9/imx93-evk/configs/knsh/defconfig
+++ b/boards/arm64/imx9/imx93-evk/configs/knsh/defconfig
@@ -148,7 +148,6 @@ CONFIG_SCHED_LPWORKSTACKSIZE=4096
 CONFIG_SCHED_WAITPID=y
 CONFIG_SDIO_BLOCKSETUP=y
 CONFIG_SEM_PREALLOCHOLDERS=32
-CONFIG_SERIAL_NPOLLWAITERS=2
 CONFIG_SERIAL_TERMIOS=y
 CONFIG_SIG_DEFAULT=y
 CONFIG_SIG_SIGALRM_ACTION=y
diff --git a/boards/arm64/imx9/imx93-evk/configs/koptee/defconfig 
b/boards/arm64/imx9/imx93-evk/configs/koptee/defconfig
index b5641a53c42..c13fdc3d7e7 100644
--- a/boards/arm64/imx9/imx93-evk/configs/koptee/defconfig
+++ b/boards/arm64/imx9/imx93-evk/configs/koptee/defconfig
@@ -153,7 +153,6 @@ CONFIG_SCHED_LPWORKSTACKSIZE=4096
 CONFIG_SCHED_WAITPID=y
 CONFIG_SDIO_BLOCKSETUP=y
 CONFIG_SEM_PREALLOCHOLDERS=32
-CONFIG_SERIAL_NPOLLWAITERS=2
 CONFIG_SERIAL_TERMIOS=y
 CONFIG_SIG_DEFAULT=y
 CONFIG_SIG_SIGALRM_ACTION=y
diff --git a/boards/risc-v/mpfs/icicle/configs/hwtest/defconfig 
b/boards/risc-v/mpfs/icicle/configs/hwtest/defconfig
index 83a0ad53bfe..43c067f6b39 100644
--- a/boards/risc-v/mpfs/icicle/configs/hwtest/defconfig
+++ b/boards/risc-v/mpfs/icicle/configs/hwtest/defconfig
@@ -100,7 +100,6 @@ CONFIG_RR_INTERVAL=200
 CONFIG_SCHED_HPWORK=y
 CONFIG_SCHED_LPWORK=y
 CONFIG_SCHED_WAITPID=y
-CONFIG_SERIAL_NPOLLWAITERS=2
 CONFIG_SPI=y
 CONFIG_SPI_CS_CONTROL=y
 CONFIG_SPI_DRIVER=y
diff --git a/boards/risc-v/mpfs/icicle/configs/knsh/defconfig 
b/boards/risc-v/mpfs/icicle/configs/knsh/defconfig
index a4950cf0343..b947dbc7f9e 100644
--- a/boards/risc-v/mpfs/icicle/configs/knsh/defconfig
+++ b/boards/risc-v/mpfs/icicle/configs/knsh/defconfig
@@ -91,7 +91,6 @@ CONFIG_SCHED_HAVE_PARENT=y
 CONFIG_SCHED_HPWORK=y
 CONFIG_SCHED_LPWORK=y
 CONFIG_SCHED_WAITPID=y
-CONFIG_SERIAL_NPOLLWAITERS=2
 CONFIG_STACK_COLORATION=y
 CONFIG_START_MONTH=4
 CONFIG_START_YEAR=2021
diff --git a/boards/risc-v/mpfs/icicle/configs/nsh/defconfig 
b/boards/risc-v/mpfs/icicle/configs/nsh/defconfig
index 2be999dccb5..f509bd927c6 100644
--- a/boards/risc-v/mpfs/icicle/configs/nsh/defconfig
+++ b/boards/risc-v/mpfs/icicle/configs/nsh/defconfig
@@ -56,7 +56,6 @@ CONFIG_RR_INTERVAL=200
 CONFIG_SCHED_HPWORK=y
 CONFIG_SCHED_LPWORK=y
 CONFIG_SCHED_WAITPID=y
-CONFIG_SERIAL_NPOLLWAITERS=2
 CONFIG_STACK_COLORATION=y
 CONFIG_START_MONTH=4
 CONFIG_START_YEAR=2021
diff --git a/boards/risc-v/mpfs/icicle/configs/opensbi/defconfig 
b/boards/risc-v/mpfs/icicle/configs/opensbi/defconfig
index 4157f76c377..2f345ae8a02 100644
--- a/boards/risc-v/mpfs/icicle/configs/opensbi/defconfig
+++ b/boards/risc-v/mpfs/icicle/configs/opensbi/defconfig
@@ -55,7 +55,6 @@ CONFIG_RR_INTERVAL=200
 CONFIG_SCHED_HPWORK=y
 CONFIG_SCHED_LPWORK=y
 CONFIG_SCHED_WAITPID=y
-CONFIG_SERIAL_NPOLLWAITERS=2
 CONFIG_STACK_COLORATION=y
 CONFIG_START_MONTH=4
 CONFIG_START_YEAR=2021
diff --git a/boards/risc-v/mpfs/icicle/configs/pnsh/defconfig 
b/boards/risc-v/mpfs/icicle/configs/pnsh/defconfig
index 0547f894477..da5e9931143 100644
--- a/boards/risc-v/mpfs/icicle/configs/pnsh/defconfig
+++ b/boards/risc-v/mpfs/icicle/configs/pnsh/defconfig
@@ -63,7 +63,6 @@ CONFIG_SCHED_HAVE_PARENT=y
 CONFIG_SCHED_HPWORK=y
 CONFIG_SCHED_LPWORK=y
 CONFIG_SCHED_WAITPID=y
-CONFIG_SERIAL_NPOLLWAITERS=2
 CONFIG_STACK_COLORATION=y
 CONFIG_START_MONTH=4
 CONFIG_START_YEAR=2021
diff --git a/boards/risc-v/mpfs/icicle/configs/rpmsg-sbi/defconfig 
b/boards/risc-v/mpfs/icicle/configs/rpmsg-sbi/defconfig
index 5f82b5ca466..c90549d7e79 100644
--- a/boards/risc-v/mpfs/icicle/configs/rpmsg-sbi/defconfig
+++ b/boards/risc-v/mpfs/icicle/configs/rpmsg-sbi/defconfig
@@ -64,7 +64,6 @@ CONFIG_RR_INTERVAL=200
 CONFIG_SCHED_HPWORK=y
 CONFIG_SCHED_LPWORK=y
 CONFIG_SCHED_WAITPID=y
-CONFIG_SERIAL_NPOLLWAITERS=2
 CONFIG_STACK_COLORATION=y
 CONFIG_START_MONTH=4
 CONFIG_START_YEAR=2021
diff --git a/boards/risc-v/mpfs/m100pfsevp/configs/nsh/defconfig 
b/boards/risc-v/mpfs/m100pfsevp/configs/nsh/defconfig
index c395a2758b6..ddc80066c39 100644
--- a/boards/risc-v/mpfs/m100pfsevp/configs/nsh/defconfig
+++ b/boards/risc-v/mpfs/m100pfsevp/configs/nsh/defconfig
@@ -55,7 +55,6 @@ CONFIG_RR_INTERVAL=200
 CONFIG_SCHED_HPWORK=y
 CONFIG_SCHED_LPWORK=y
 CONFIG_SCHED_WAITPID=y
-CONFIG_SERIAL_NPOLLWAITERS=2
 CONFIG_STACK_COLORATION=y
 CONFIG_START_MONTH=4
 CONFIG_START_YEAR=2021
diff --git 
a/boards/xtensa/esp32/esp32-devkitc/configs/wamr_wasi_debug/defconfig 
b/boards/xtensa/esp32/esp32-devkitc/configs/wamr_wasi_debug/defconfig
index 75ec225f840..a4487f3c740 100644
--- a/boards/xtensa/esp32/esp32-devkitc/configs/wamr_wasi_debug/defconfig
+++ b/boards/xtensa/esp32/esp32-devkitc/configs/wamr_wasi_debug/defconfig
@@ -100,7 +100,6 @@ CONFIG_SCHED_HPWORK=y
 CONFIG_SCHED_HPWORKSTACKSIZE=2048
 CONFIG_SCHED_LPWORK=y
 CONFIG_SCHED_WAITPID=y
-CONFIG_SERIAL_NPOLLWAITERS=2
 CONFIG_SIG_DEFAULT=y
 CONFIG_SPI=y
 CONFIG_START_DAY=6
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
index d4b11274d75..9766cc5da36 100644
--- a/drivers/serial/Kconfig
+++ b/drivers/serial/Kconfig
@@ -254,10 +254,10 @@ config STANDARD_SERIAL
 
 config SERIAL_NPOLLWAITERS
        int "Number of poll threads"
-       default 4
+       default 2
        ---help---
                Maximum number of threads than can be waiting for POLL events.
-               Default: 4
+               Default: 2
 
 config SERIAL_IFLOWCONTROL
        bool
diff --git a/include/nuttx/serial/serial.h b/include/nuttx/serial/serial.h
index ff532a183d7..c58cf57dac6 100644
--- a/include/nuttx/serial/serial.h
+++ b/include/nuttx/serial/serial.h
@@ -46,7 +46,7 @@
 /* Maximum number of threads than can be waiting for POLL events */
 
 #ifndef CONFIG_SERIAL_NPOLLWAITERS
-#  define CONFIG_SERIAL_NPOLLWAITERS 4
+#  define CONFIG_SERIAL_NPOLLWAITERS 2
 #endif
 
 /* RX flow control */

Reply via email to