sched: remove param in nxsched_remove_readytorun

after
   text    data     bss     dec     hex filename
 269732   51065   63335  384132   5dc84 nuttx

before
   text    data     bss     dec     hex filename
269784   51065   63335  384184   5dcb8 nuttx

size -50

Signed-off-by: hujun5 <hujun5@xiaomi.com>
This commit is contained in:
hujun5
2024-10-09 19:52:29 +08:00
committed by Xiang Xiao
parent 37a30023f5
commit 67c9a7aabd
7 changed files with 19 additions and 29 deletions
+1 -1
View File
@@ -325,7 +325,7 @@ int nxthread_create(FAR const char *name, uint8_t ttype, int priority,
/* Task list manipulation functions */ /* Task list manipulation functions */
bool nxsched_add_readytorun(FAR struct tcb_s *rtrtcb); bool nxsched_add_readytorun(FAR struct tcb_s *rtrtcb);
bool nxsched_remove_readytorun(FAR struct tcb_s *rtrtcb, bool merge); bool nxsched_remove_readytorun(FAR struct tcb_s *rtrtcb);
void nxsched_remove_self(FAR struct tcb_s *rtrtcb); void nxsched_remove_self(FAR struct tcb_s *rtrtcb);
bool nxsched_add_prioritized(FAR struct tcb_s *tcb, DSEG dq_queue_t *list); bool nxsched_add_prioritized(FAR struct tcb_s *tcb, DSEG dq_queue_t *list);
void nxsched_merge_prioritized(FAR dq_queue_t *list1, FAR dq_queue_t *list2, void nxsched_merge_prioritized(FAR dq_queue_t *list1, FAR dq_queue_t *list2,
+5 -20
View File
@@ -47,7 +47,6 @@
* *
* Input Parameters: * Input Parameters:
* rtcb - Points to the TCB that is ready-to-run * rtcb - Points to the TCB that is ready-to-run
* merge - Merge pending list or not
* *
* Returned Value: * Returned Value:
* true if the currently active task (the head of the ready-to-run list) * true if the currently active task (the head of the ready-to-run list)
@@ -63,7 +62,7 @@
****************************************************************************/ ****************************************************************************/
#ifndef CONFIG_SMP #ifndef CONFIG_SMP
bool nxsched_remove_readytorun(FAR struct tcb_s *rtcb, bool merge) bool nxsched_remove_readytorun(FAR struct tcb_s *rtcb)
{ {
FAR dq_queue_t *tasklist; FAR dq_queue_t *tasklist;
bool doswitch = false; bool doswitch = false;
@@ -99,17 +98,12 @@ bool nxsched_remove_readytorun(FAR struct tcb_s *rtcb, bool merge)
rtcb->task_state = TSTATE_TASK_INVALID; rtcb->task_state = TSTATE_TASK_INVALID;
if (list_pendingtasks()->head && merge)
{
doswitch |= nxsched_merge_pending();
}
return doswitch; return doswitch;
} }
void nxsched_remove_self(FAR struct tcb_s *tcb) void nxsched_remove_self(FAR struct tcb_s *tcb)
{ {
nxsched_remove_readytorun(tcb, true); nxsched_remove_readytorun(tcb);
} }
#endif /* !CONFIG_SMP */ #endif /* !CONFIG_SMP */
@@ -121,7 +115,6 @@ void nxsched_remove_self(FAR struct tcb_s *tcb)
* *
* Input Parameters: * Input Parameters:
* rtcb - Points to the TCB that is ready-to-run * rtcb - Points to the TCB that is ready-to-run
* merge - Merge pending list or not
* *
* Returned Value: * Returned Value:
* true if the currently active task (the head of the ready-to-run list) * true if the currently active task (the head of the ready-to-run list)
@@ -284,10 +277,8 @@ void nxsched_remove_self(FAR struct tcb_s *tcb)
} }
} }
bool nxsched_remove_readytorun(FAR struct tcb_s *tcb, bool merge) bool nxsched_remove_readytorun(FAR struct tcb_s *tcb)
{ {
bool doswitch = false;
if (tcb->task_state == TSTATE_TASK_RUNNING) if (tcb->task_state == TSTATE_TASK_RUNNING)
{ {
DEBUGASSERT(tcb->cpu == this_cpu()); DEBUGASSERT(tcb->cpu == this_cpu());
@@ -307,7 +298,7 @@ bool nxsched_remove_readytorun(FAR struct tcb_s *tcb, bool merge)
{ {
g_delivertasks[i] = NULL; g_delivertasks[i] = NULL;
tcb->task_state = TSTATE_TASK_INVALID; tcb->task_state = TSTATE_TASK_INVALID;
goto finish; return false;
} }
} }
@@ -327,12 +318,6 @@ bool nxsched_remove_readytorun(FAR struct tcb_s *tcb, bool merge)
tcb->task_state = TSTATE_TASK_INVALID; tcb->task_state = TSTATE_TASK_INVALID;
} }
finish: return false;
if (list_pendingtasks()->head && merge)
{
doswitch |= nxsched_merge_pending();
}
return doswitch;
} }
#endif /* CONFIG_SMP */ #endif /* CONFIG_SMP */
+1 -1
View File
@@ -64,7 +64,7 @@ bool nxsched_reprioritize_rtr(FAR struct tcb_s *tcb, int priority)
* remove the head of the ready to run list. * remove the head of the ready to run list.
*/ */
switch_needed = nxsched_remove_readytorun(tcb, false); switch_needed = nxsched_remove_readytorun(tcb);
/* Setup up the new task priority */ /* Setup up the new task priority */
+1 -1
View File
@@ -200,7 +200,7 @@ static inline void nxsched_running_setpriority(FAR struct tcb_s *tcb,
do do
{ {
bool check = nxsched_remove_readytorun(nxttcb, false); bool check = nxsched_remove_readytorun(nxttcb);
DEBUGASSERT(check == false); DEBUGASSERT(check == false);
UNUSED(check); UNUSED(check);
+7 -2
View File
@@ -77,7 +77,7 @@ static int nxsched_suspend_handler(FAR void *cookie)
tcb->flags = arg->saved_flags; tcb->flags = arg->saved_flags;
} }
nxsched_remove_readytorun(tcb, false); nxsched_remove_readytorun(tcb);
tcb->task_state = TSTATE_TASK_STOPPED; tcb->task_state = TSTATE_TASK_STOPPED;
dq_addlast((FAR dq_entry_t *)tcb, &g_stoppedtasks); dq_addlast((FAR dq_entry_t *)tcb, &g_stoppedtasks);
@@ -172,7 +172,12 @@ void nxsched_suspend(FAR struct tcb_s *tcb)
else else
#endif #endif
{ {
switch_needed = nxsched_remove_readytorun(tcb, true); switch_needed = nxsched_remove_readytorun(tcb);
if (list_pendingtasks()->head)
{
switch_needed |= nxsched_merge_pending();
}
/* Add the task to the specified blocked task list */ /* Add the task to the specified blocked task list */
+2 -2
View File
@@ -83,7 +83,7 @@ static int restart_handler(FAR void *cookie)
tcb->flags = arg->saved_flags; tcb->flags = arg->saved_flags;
} }
nxsched_remove_readytorun(tcb, false); nxsched_remove_readytorun(tcb);
leave_critical_section(flags); leave_critical_section(flags);
@@ -117,7 +117,7 @@ static void nxtask_reset_task(FAR struct tcb_s *tcb, bool remove)
if (remove) if (remove)
{ {
nxsched_remove_readytorun(tcb, false); nxsched_remove_readytorun(tcb);
} }
/* Deallocate anything left in the TCB's signal queues */ /* Deallocate anything left in the TCB's signal queues */
+2 -2
View File
@@ -66,7 +66,7 @@ static int terminat_handler(FAR void *cookie)
return -ESRCH; return -ESRCH;
} }
nxsched_remove_readytorun(tcb, false); nxsched_remove_readytorun(tcb);
leave_critical_section(flags); leave_critical_section(flags);
return OK; return OK;
@@ -164,7 +164,7 @@ int nxtask_terminate(pid_t pid)
else else
#endif #endif
{ {
nxsched_remove_readytorun(dtcb, false); nxsched_remove_readytorun(dtcb);
} }
dtcb->task_state = task_state; dtcb->task_state = task_state;