You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2026/09/10 15:28:51 UTC

(nuttx) 01/02: mm/pgalloc: support 32 KB and 64 KB page sizes

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

commit 4770f7b46cc0d37f3401d41ebfa3d241b8a045d9
Author: Marco Casaroli <ma...@gmail.com>
AuthorDate: Thu Jul 30 14:16:02 2026 +0200

    mm/pgalloc: support 32 KB and 64 KB page sizes
    
    Add CONFIG_MM_PGSIZE == 32768 and 65536 to the page-size switch (and the
    Kconfig help text). The 64 KB size matches the ESP32-S3 cache-MMU page
    granularity, so an address-environment port there can use one mm_pgalloc()
    page per cache-MMU page (naturally 64 KB-aligned by the granule allocator)
    instead of coalescing several smaller pages. Inert for existing configs:
    MM_PGSIZE is only used when CONFIG_MM_PGALLOC is enabled (BUILD_KERNEL).
    
    Assisted-by: Claude Opus 4.8 (1M context) <no...@anthropic.com>
    Signed-off-by: Marco Casaroli <ma...@gmail.com>
---
 include/nuttx/pgalloc.h | 6 ++++++
 mm/Kconfig              | 7 ++++---
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/include/nuttx/pgalloc.h b/include/nuttx/pgalloc.h
index 33f6a937b45..bec03d9b4e7 100644
--- a/include/nuttx/pgalloc.h
+++ b/include/nuttx/pgalloc.h
@@ -69,6 +69,12 @@
 #elif CONFIG_MM_PGSIZE == 16384
 #  define MM_PGSIZE       16384
 #  define MM_PGSHIFT      14
+#elif CONFIG_MM_PGSIZE == 32768
+#  define MM_PGSIZE       32768
+#  define MM_PGSHIFT      15
+#elif CONFIG_MM_PGSIZE == 65536
+#  define MM_PGSIZE       65536
+#  define MM_PGSHIFT      16
 #else
 #  error CONFIG_MM_PGSIZE not supported
 #endif
diff --git a/mm/Kconfig b/mm/Kconfig
index aebba1d0130..e0b8441a6ae 100644
--- a/mm/Kconfig
+++ b/mm/Kconfig
@@ -301,9 +301,10 @@ config MM_PGSIZE
 	int "Page Size"
 	default 4096
 	---help---
-		The MMU page size.  Must be one of {1024, 2048, 4096, 8192, or
-		16384}.  This is easily extensible, but only those values are
-		currently support.
+		The MMU page size.  Must be one of {1024, 2048, 4096, 8192, 16384,
+		32768, or 65536}.  This is easily extensible, but only those values
+		are currently support.  64 KB (65536) matches the ESP32-S3 cache-MMU
+		page size.
 
 config DEBUG_PGALLOC
 	bool "Page Allocator Debug"