anjiahao1 opened a new pull request, #22619:
URL: https://github.com/apache/nuttx/pull/22619

   ## Summary
   
   Add a per-task-group heap (`CONFIG_MM_TASK_HEAP`).  A task group may own a
   private heap carved from the user heap, and the user-space allocators
   (`USR_HEAP` via `umm_getheap()`) switch to it for the running task.  The
   series is ported from the Vela tree as a sequence of cherry-picks.
   
   - new `CONFIG_MM_TASK_HEAP` with `MM_TASK_HEAP_DEFAULT_SIZE` and
     `MM_TASK_HEAP_DEFAULT_ALIGN`.  The default size is 0, which shares the
     user heap; a board can configure a private default.
   - the task information carries `ta_heap`; `struct task_group_s` gains
     `tg_heap`.  `group_allocate()` sizes the heap, and a `vfork()` child
     shares the heap of its parent.
   - `group_malloc()`, `group_realloc()`, `group_zalloc()`, `group_free()`
     and `umm_getheap()` use the task heap.
   - the environment is allocated from the heap of the task it belongs to.
   - `binfmt/builtin` and `posix_spawn()` propagate the configured
     heapsize to the new task.
   
   ## Impact
   
   New option, disabled by default; existing configurations are unchanged.
   
   Known limitations:
   
   - only builds with a separate kernel heap (`CONFIG_MM_KERNEL_HEAP`) may
     enable the option, otherwise the `kmm_*` allocators would route
     kernel allocations into the task heap;
   - `BUILD_KERNEL` is not supported yet;
   - moving task stacks into the group heap depends on the task-group
     lifetime rework and is left for a follow-up.
   
   ## Testing
   
   - Built with `cmake` for `sim:nsh`, and with `make` for
     `mps3-an547:nsh`, `mps3-an547:knsh` and `mps3-an547:knsh` with
     `CONFIG_MM_TASK_HEAP=y` and `CONFIG_MM_TASK_HEAP_DEFAULT_SIZE=65536`.
   - Runtime, `qemu-system-arm -M mps3-an547` (protected build, kernel +
     user blob): `nsh` prompt, `hello`, and the `heap` test suite run
     against a 64 KiB per-task heap, no assertion failures.
   - The QEMU console of this board needs the RX/TX interrupt assignment
     swapped (TX=49, RX=50); the board fix is proposed separately.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to