mirror of
https://github.com/apache/nuttx.git
synced 2026-06-01 16:59:28 +08:00
arch: fix the sched parameter update when exiting
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
This commit is contained in:
@@ -152,6 +152,12 @@ uint32_t *arm_syscall(uint32_t *regs)
|
|||||||
|
|
||||||
cpu = this_cpu();
|
cpu = this_cpu();
|
||||||
tcb = current_task(cpu);
|
tcb = current_task(cpu);
|
||||||
|
|
||||||
|
/* Update scheduler parameters */
|
||||||
|
|
||||||
|
nxsched_suspend_scheduler(g_running_tasks[cpu]);
|
||||||
|
nxsched_resume_scheduler(tcb);
|
||||||
|
|
||||||
g_running_tasks[cpu] = tcb;
|
g_running_tasks[cpu] = tcb;
|
||||||
|
|
||||||
/* Restore the cpu lock */
|
/* Restore the cpu lock */
|
||||||
|
|||||||
@@ -66,11 +66,9 @@ void up_exit(int status)
|
|||||||
|
|
||||||
tcb = this_task();
|
tcb = this_task();
|
||||||
|
|
||||||
/* Adjusts time slice for SCHED_RR & SCHED_SPORADIC cases
|
/* Scheduler parameters will update inside syscall */
|
||||||
* NOTE: the API also adjusts the global IRQ control for SMP
|
|
||||||
*/
|
|
||||||
|
|
||||||
nxsched_resume_scheduler(tcb);
|
g_running_tasks[this_cpu()] = NULL;
|
||||||
|
|
||||||
/* Then switch contexts */
|
/* Then switch contexts */
|
||||||
|
|
||||||
|
|||||||
@@ -70,11 +70,9 @@ void up_exit(int status)
|
|||||||
|
|
||||||
tcb = this_task();
|
tcb = this_task();
|
||||||
|
|
||||||
/* Adjusts time slice for SCHED_RR & SCHED_SPORADIC cases
|
/* Scheduler parameters will update inside syscall */
|
||||||
* NOTE: the API also adjusts the global IRQ control for SMP
|
|
||||||
*/
|
|
||||||
|
|
||||||
nxsched_resume_scheduler(tcb);
|
g_running_tasks[this_cpu()] = NULL;
|
||||||
|
|
||||||
/* Then switch contexts */
|
/* Then switch contexts */
|
||||||
|
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ void up_exit(int status)
|
|||||||
/* Adjusts time slice for SCHED_RR & SCHED_SPORADIC cases */
|
/* Adjusts time slice for SCHED_RR & SCHED_SPORADIC cases */
|
||||||
|
|
||||||
nxsched_resume_scheduler(tcb);
|
nxsched_resume_scheduler(tcb);
|
||||||
|
g_running_tasks[this_cpu()] = tcb;
|
||||||
|
|
||||||
#ifdef CONFIG_ARCH_ADDRENV
|
#ifdef CONFIG_ARCH_ADDRENV
|
||||||
/* Make sure that the address environment for the previously running
|
/* Make sure that the address environment for the previously running
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ void up_exit(int status)
|
|||||||
/* Adjusts time slice for SCHED_RR & SCHED_SPORADIC cases */
|
/* Adjusts time slice for SCHED_RR & SCHED_SPORADIC cases */
|
||||||
|
|
||||||
nxsched_resume_scheduler(tcb);
|
nxsched_resume_scheduler(tcb);
|
||||||
|
g_running_tasks[this_cpu()] = tcb;
|
||||||
|
|
||||||
#ifdef CONFIG_ARCH_ADDRENV
|
#ifdef CONFIG_ARCH_ADDRENV
|
||||||
/* Make sure that the address environment for the previously running
|
/* Make sure that the address environment for the previously running
|
||||||
|
|||||||
@@ -66,11 +66,9 @@ void up_exit(int status)
|
|||||||
|
|
||||||
tcb = this_task();
|
tcb = this_task();
|
||||||
|
|
||||||
/* Adjusts time slice for SCHED_RR & SCHED_SPORADIC cases
|
/* Scheduler parameters will update inside syscall */
|
||||||
* NOTE: the API also adjusts the global IRQ control for SMP
|
|
||||||
*/
|
|
||||||
|
|
||||||
nxsched_resume_scheduler(tcb);
|
g_running_tasks[this_cpu()] = NULL;
|
||||||
|
|
||||||
/* Then switch contexts */
|
/* Then switch contexts */
|
||||||
|
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ void up_exit(int status)
|
|||||||
|
|
||||||
/* Adjusts time slice for RR & SPORADIC cases */
|
/* Adjusts time slice for RR & SPORADIC cases */
|
||||||
|
|
||||||
nxsched_resume_scheduler(tcb);
|
g_running_tasks[this_cpu()] = NULL;
|
||||||
|
|
||||||
/* Then switch contexts */
|
/* Then switch contexts */
|
||||||
|
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ void up_exit(int status)
|
|||||||
|
|
||||||
/* Adjusts time slice for SCHED_RR & SCHED_SPORADIC cases */
|
/* Adjusts time slice for SCHED_RR & SCHED_SPORADIC cases */
|
||||||
|
|
||||||
nxsched_resume_scheduler(tcb);
|
g_running_tasks[this_cpu()] = NULL;
|
||||||
|
|
||||||
/* Then switch contexts */
|
/* Then switch contexts */
|
||||||
|
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ void up_exit(int status)
|
|||||||
/* Adjusts time slice for SCHED_RR & SCHED_SPORADIC cases */
|
/* Adjusts time slice for SCHED_RR & SCHED_SPORADIC cases */
|
||||||
|
|
||||||
nxsched_resume_scheduler(tcb);
|
nxsched_resume_scheduler(tcb);
|
||||||
|
g_running_tasks[this_cpu()] = tcb;
|
||||||
|
|
||||||
#ifdef CONFIG_ARCH_ADDRENV
|
#ifdef CONFIG_ARCH_ADDRENV
|
||||||
/* Make sure that the address environment for the previously running
|
/* Make sure that the address environment for the previously running
|
||||||
|
|||||||
@@ -64,9 +64,10 @@ void up_exit(int status)
|
|||||||
|
|
||||||
tcb = this_task();
|
tcb = this_task();
|
||||||
|
|
||||||
/* Adjusts time slice for RR & SPORADIC cases */
|
/* Adjusts time slice for SCHED_RR & SCHED_SPORADIC cases */
|
||||||
|
|
||||||
nxsched_resume_scheduler(tcb);
|
nxsched_resume_scheduler(tcb);
|
||||||
|
g_running_tasks[this_cpu()] = tcb;
|
||||||
|
|
||||||
#ifdef CONFIG_ARCH_ADDRENV
|
#ifdef CONFIG_ARCH_ADDRENV
|
||||||
/* Make sure that the address environment for the previously running
|
/* Make sure that the address environment for the previously running
|
||||||
|
|||||||
@@ -66,13 +66,7 @@ void up_exit(int status)
|
|||||||
|
|
||||||
tcb = this_task();
|
tcb = this_task();
|
||||||
|
|
||||||
/* Adjusts time slice for SCHED_RR & SCHED_SPORADIC cases
|
/* Scheduler parameters will update inside syscall */
|
||||||
* NOTE: the API also adjusts the global IRQ control for SMP
|
|
||||||
*/
|
|
||||||
|
|
||||||
nxsched_resume_scheduler(tcb);
|
|
||||||
|
|
||||||
/* g_running_tasks is not valid now */
|
|
||||||
|
|
||||||
g_running_tasks[this_cpu()] = NULL;
|
g_running_tasks[this_cpu()] = NULL;
|
||||||
|
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ void up_exit(int status)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
nxsched_resume_scheduler(tcb);
|
nxsched_resume_scheduler(tcb);
|
||||||
|
g_running_tasks[this_cpu()] = tcb;
|
||||||
|
|
||||||
/* Restore the cpu lock */
|
/* Restore the cpu lock */
|
||||||
|
|
||||||
|
|||||||
@@ -70,9 +70,9 @@ void up_exit(int status)
|
|||||||
|
|
||||||
tcb = this_task();
|
tcb = this_task();
|
||||||
|
|
||||||
/* Reset scheduler parameters */
|
/* Scheduler parameters will update inside syscall */
|
||||||
|
|
||||||
nxsched_resume_scheduler(tcb);
|
g_running_tasks[this_cpu()] = NULL;
|
||||||
|
|
||||||
/* Then switch contexts */
|
/* Then switch contexts */
|
||||||
|
|
||||||
|
|||||||
@@ -66,11 +66,9 @@ void up_exit(int status)
|
|||||||
|
|
||||||
tcb = this_task();
|
tcb = this_task();
|
||||||
|
|
||||||
/* Adjusts time slice for SCHED_RR & SCHED_SPORADIC cases
|
/* Scheduler parameters will update inside syscall */
|
||||||
* NOTE: the API also adjusts the global IRQ control for SMP
|
|
||||||
*/
|
|
||||||
|
|
||||||
nxsched_resume_scheduler(tcb);
|
g_running_tasks[this_cpu()] = NULL;
|
||||||
|
|
||||||
/* Then switch contexts */
|
/* Then switch contexts */
|
||||||
|
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ void up_exit(int status)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
nxsched_resume_scheduler(tcb);
|
nxsched_resume_scheduler(tcb);
|
||||||
|
g_running_tasks[this_cpu()] = tcb;
|
||||||
|
|
||||||
#ifdef CONFIG_ARCH_ADDRENV
|
#ifdef CONFIG_ARCH_ADDRENV
|
||||||
/* Make sure that the address environment for the previously running
|
/* Make sure that the address environment for the previously running
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ void up_exit(int status)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
nxsched_resume_scheduler(tcb);
|
nxsched_resume_scheduler(tcb);
|
||||||
|
g_running_tasks[this_cpu()] = tcb;
|
||||||
|
|
||||||
/* Context switch, rearrange MMU */
|
/* Context switch, rearrange MMU */
|
||||||
|
|
||||||
|
|||||||
@@ -66,11 +66,9 @@ void up_exit(int status)
|
|||||||
|
|
||||||
tcb = this_task();
|
tcb = this_task();
|
||||||
|
|
||||||
/* Adjusts time slice for SCHED_RR & SCHED_SPORADIC cases
|
/* Scheduler parameters will update inside syscall */
|
||||||
* NOTE: the API also adjusts the global IRQ control for SMP
|
|
||||||
*/
|
|
||||||
|
|
||||||
nxsched_resume_scheduler(tcb);
|
g_running_tasks[this_cpu()] = NULL;
|
||||||
|
|
||||||
/* Then switch contexts */
|
/* Then switch contexts */
|
||||||
|
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ void up_exit(int status)
|
|||||||
/* Adjusts time slice for SCHED_RR & SCHED_SPORADIC cases */
|
/* Adjusts time slice for SCHED_RR & SCHED_SPORADIC cases */
|
||||||
|
|
||||||
nxsched_resume_scheduler(tcb);
|
nxsched_resume_scheduler(tcb);
|
||||||
|
g_running_tasks[this_cpu()] = tcb;
|
||||||
|
|
||||||
/* Then switch contexts */
|
/* Then switch contexts */
|
||||||
|
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ void up_exit(int status)
|
|||||||
/* Adjusts time slice for SCHED_RR & SCHED_SPORADIC cases */
|
/* Adjusts time slice for SCHED_RR & SCHED_SPORADIC cases */
|
||||||
|
|
||||||
nxsched_resume_scheduler(tcb);
|
nxsched_resume_scheduler(tcb);
|
||||||
|
g_running_tasks[this_cpu()] = tcb;
|
||||||
|
|
||||||
#ifdef CONFIG_ARCH_ADDRENV
|
#ifdef CONFIG_ARCH_ADDRENV
|
||||||
/* Make sure that the address environment for the previously running
|
/* Make sure that the address environment for the previously running
|
||||||
|
|||||||
@@ -61,6 +61,13 @@
|
|||||||
|
|
||||||
void nxsched_suspend_scheduler(FAR struct tcb_s *tcb)
|
void nxsched_suspend_scheduler(FAR struct tcb_s *tcb)
|
||||||
{
|
{
|
||||||
|
/* Handle the task exiting case */
|
||||||
|
|
||||||
|
if (tcb != NULL)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_SCHED_SPORADIC
|
#ifdef CONFIG_SCHED_SPORADIC
|
||||||
/* Perform sporadic schedule operations */
|
/* Perform sporadic schedule operations */
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user