arch: fix the sched parameter update when exiting

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
This commit is contained in:
buxiasen
2024-08-01 23:05:29 +08:00
committed by Xiang Xiao
parent 4e5a963443
commit 0b3859521a
20 changed files with 38 additions and 32 deletions
+6
View File
@@ -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 */
+2 -4
View File
@@ -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 */
+2 -4
View File
@@ -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 */
+1
View File
@@ -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
+1
View File
@@ -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
+2 -4
View File
@@ -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 */
+1 -1
View File
@@ -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 */
+1 -1
View File
@@ -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 */
+1
View File
@@ -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
+2 -1
View File
@@ -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
+1 -7
View File
@@ -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;
+1
View File
@@ -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 */
+2 -2
View File
@@ -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 */
+2 -4
View File
@@ -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 */
+1
View File
@@ -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
+1
View File
@@ -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 */
+2 -4
View File
@@ -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 */
+1
View File
@@ -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 */
+1
View File
@@ -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
+7
View File
@@ -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 */