Skip to content

Commit a041ebb

Browse files
Donny9xiaoxiang781216
authored andcommitted
Revert "sched/group/setuptask_file: duplicate idle task fd for kernel thread"
let's using shared group for kthreads, see pull/12320 This reverts commit 4e24eec.
1 parent 69f3774 commit a041ebb

File tree

3 files changed

+3
-26
lines changed

3 files changed

+3
-26
lines changed

sched/group/group_setuptaskfiles.c

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ int group_setuptaskfiles(FAR struct task_tcb_s *tcb,
6666
FAR struct task_group_s *group = tcb->cmn.group;
6767
int ret = OK;
6868
#ifndef CONFIG_FDCLONE_DISABLE
69-
FAR struct tcb_s *rtcb;
69+
FAR struct tcb_s *rtcb = this_task();
7070
#endif
7171

7272
sched_trace_begin();
@@ -77,20 +77,7 @@ int group_setuptaskfiles(FAR struct task_tcb_s *tcb,
7777
#endif
7878

7979
#ifndef CONFIG_FDCLONE_DISABLE
80-
81-
/* The The file descriptors of kernel threads should be clean and
82-
* should not be generated based on user threads. Instead, an idle
83-
* thread should be chosen.
84-
*/
85-
86-
if ((tcb->cmn.flags & TCB_FLAG_TTYPE_MASK) == TCB_FLAG_TTYPE_KERNEL)
87-
{
88-
rtcb = &g_idletcb[this_cpu()];
89-
}
90-
else
91-
{
92-
rtcb = this_task();
93-
}
80+
DEBUGASSERT(rtcb->group);
9481

9582
/* Duplicate the parent task's file descriptors */
9683

sched/init/nx_start.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ volatile uint8_t g_nx_initstate; /* See enum nx_initstate_e */
209209
* bringing up the rest of the system.
210210
*/
211211

212-
struct tcb_s g_idletcb[CONFIG_SMP_NCPUS];
212+
static struct tcb_s g_idletcb[CONFIG_SMP_NCPUS];
213213

214214
/* This is the name of the idle task */
215215

sched/sched/sched.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -204,16 +204,6 @@ extern FAR struct tcb_s *g_delivertasks[CONFIG_SMP_NCPUS];
204204

205205
extern FAR struct tcb_s *g_running_tasks[CONFIG_SMP_NCPUS];
206206

207-
/* This is an array of task control block (TCB) for the IDLE thread of each
208-
* CPU. For the non-SMP case, this is a a single TCB; For the SMP case,
209-
* there is one TCB per CPU. NOTE: The system boots on CPU0 into the IDLE
210-
* task. The IDLE task later starts the other CPUs and spawns the user
211-
* initialization task. That user initialization task is responsible for
212-
* bringing up the rest of the system.
213-
*/
214-
215-
extern struct tcb_s g_idletcb[CONFIG_SMP_NCPUS];
216-
217207
/* This is the list of all tasks that are ready-to-run, but cannot be placed
218208
* in the g_readytorun list because: (1) They are higher priority than the
219209
* currently active task at the head of the g_readytorun list, and (2) the

0 commit comments

Comments
 (0)