anchao commented on code in PR #12320:
URL: https://github.com/apache/nuttx/pull/12320#discussion_r1596662062
##########
sched/group/group_create.c:
##########
@@ -119,20 +121,42 @@ int group_initialize(FAR struct task_tcb_s *tcb, uint8_t
ttype)
DEBUGASSERT(tcb && !tcb->cmn.group);
+ ttype &= TCB_FLAG_TTYPE_MASK;
+
+ /* Late coming kthread reuses the shared group */
+
+ if (ttype == TCB_FLAG_TTYPE_KERNEL && g_kthread_group.tg_info)
+ {
+ tcb->cmn.group = &g_kthread_group;
+ return OK;
+ }
+
+ if (!g_kthread_group.tg_info)
+ {
+ sinfo("sizeof(*group)=%zu\n", sizeof(*group));
+ }
+
/* Allocate the group structure and assign it to the TCB */
- group = &tcb->group;
+ group = (ttype == TCB_FLAG_TTYPE_KERNEL) ? &g_kthread_group :
+ kmm_zalloc(sizeof(*group));
Review Comment:
```suggestion
```
I have an extreme requirement for the initialization of task structure. All
resources must be deterministic in nxtask_init(), which means that there cannot
be any access to the memory allocator, Currently in flat mode, all resources
except tcb/stack could be configured statically. could you implement this PR
based on this premise?
--
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]