From ea180792a3df683cc5fd2b0c24786d6a11bfb5a1 Mon Sep 17 00:00:00 2001 From: wangzhi16 Date: Tue, 30 Dec 2025 19:58:12 +0800 Subject: [PATCH] sched/task: fix Redundant memory allocation. Since the task and group structures are no longer allocated in the same space, the memory for group is allocated in the group_allocate() function, and no further allocation is needed during the task allocation process. Signed-off-by: wangzhi16 --- Documentation/guides/kernel_threads_with_custom_stacks.rst | 2 +- sched/task/task_fork.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/guides/kernel_threads_with_custom_stacks.rst b/Documentation/guides/kernel_threads_with_custom_stacks.rst index c180e0200d7..c2f3b48a583 100644 --- a/Documentation/guides/kernel_threads_with_custom_stacks.rst +++ b/Documentation/guides/kernel_threads_with_custom_stacks.rst @@ -31,7 +31,7 @@ Here is the body of some function. It expects to have the following inputs: * used to that all fields of the new TCB will be zeroed. */ - tcb = kmm_zalloc(sizeof(struct tcb_s) + sizeof(struct task_group_s)); + tcb = kmm_zalloc(sizeof(struct tcb_s)); if (tcb == NULL) { return -ENOMEM; diff --git a/sched/task/task_fork.c b/sched/task/task_fork.c index d9a79f4d126..59bdf5611bb 100644 --- a/sched/task/task_fork.c +++ b/sched/task/task_fork.c @@ -137,7 +137,7 @@ FAR struct tcb_s *nxtask_setup_fork(start_t retaddr) /* Allocate a TCB for the child task. */ - child = kmm_zalloc(sizeof(struct tcb_s) + sizeof(struct task_group_s)); + child = kmm_zalloc(sizeof(struct tcb_s)); if (!child) { serr("ERROR: Failed to allocate TCB\n");