From a23b30d6250ec7e1440aa106fca0e6cf3ffcd365 Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Mon, 29 Aug 2022 16:39:43 +0800 Subject: [PATCH] sched: Remove volatile from the task list it inappropriate to apply volatile to the task list: 1.The code access task list is already protected by critical section 2.The queue is complex struct, it isn't enough to protect by volatile Signed-off-by: Xiang Xiao --- sched/init/nx_start.c | 20 ++++++++++---------- sched/sched/sched.h | 22 +++++++++++----------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/sched/init/nx_start.c b/sched/init/nx_start.c index f6bcff4e42d..52b13279d1b 100644 --- a/sched/init/nx_start.c +++ b/sched/init/nx_start.c @@ -84,7 +84,7 @@ * task, is always the IDLE task. */ -volatile dq_queue_t g_readytorun; +dq_queue_t g_readytorun; /* In order to support SMP, the function of the g_readytorun list changes, * The g_readytorun is still used but in the SMP case it will contain only: @@ -117,7 +117,7 @@ volatile dq_queue_t g_readytorun; */ #ifdef CONFIG_SMP -volatile dq_queue_t g_assignedtasks[CONFIG_SMP_NCPUS]; +dq_queue_t g_assignedtasks[CONFIG_SMP_NCPUS]; #endif /* g_running_tasks[] holds a references to the running task for each cpu. @@ -132,22 +132,22 @@ FAR struct tcb_s *g_running_tasks[CONFIG_SMP_NCPUS]; * currently active task has disabled pre-emption. */ -volatile dq_queue_t g_pendingtasks; +dq_queue_t g_pendingtasks; /* This is the list of all tasks that are blocked waiting for a semaphore */ -volatile dq_queue_t g_waitingforsemaphore; +dq_queue_t g_waitingforsemaphore; /* This is the list of all tasks that are blocked waiting for a signal */ -volatile dq_queue_t g_waitingforsignal; +dq_queue_t g_waitingforsignal; #ifndef CONFIG_DISABLE_MQUEUE /* This is the list of all tasks that are blocked waiting for a message * queue to become non-empty. */ -volatile dq_queue_t g_waitingformqnotempty; +dq_queue_t g_waitingformqnotempty; #endif #ifndef CONFIG_DISABLE_MQUEUE @@ -155,13 +155,13 @@ volatile dq_queue_t g_waitingformqnotempty; * queue to become non-full. */ -volatile dq_queue_t g_waitingformqnotfull; +dq_queue_t g_waitingformqnotfull; #endif #ifdef CONFIG_PAGING /* This is the list of all tasks that are blocking waiting for a page fill */ -volatile dq_queue_t g_waitingforfill; +dq_queue_t g_waitingforfill; #endif #ifdef CONFIG_SIG_SIGSTOP_ACTION @@ -169,14 +169,14 @@ volatile dq_queue_t g_waitingforfill; * via SIGSTOP or SIGTSTP */ -volatile dq_queue_t g_stoppedtasks; +dq_queue_t g_stoppedtasks; #endif /* This the list of all tasks that have been initialized, but not yet * activated. NOTE: This is the only list that is not prioritized. */ -volatile dq_queue_t g_inactivetasks; +dq_queue_t g_inactivetasks; /* This is the value of the last process ID assigned to a task */ diff --git a/sched/sched/sched.h b/sched/sched/sched.h index 38e60031f51..6110976dc18 100644 --- a/sched/sched/sched.h +++ b/sched/sched/sched.h @@ -96,8 +96,8 @@ struct tasklist_s { - DSEG volatile dq_queue_t *list; /* Pointer to the task list */ - uint8_t attr; /* List attribute flags */ + DSEG dq_queue_t *list; /* Pointer to the task list */ + uint8_t attr; /* List attribute flags */ }; /**************************************************************************** @@ -121,7 +121,7 @@ struct tasklist_s * task, is always the IDLE task. */ -extern volatile dq_queue_t g_readytorun; +extern dq_queue_t g_readytorun; #ifdef CONFIG_SMP /* In order to support SMP, the function of the g_readytorun list changes, @@ -154,7 +154,7 @@ extern volatile dq_queue_t g_readytorun; * always the CPU's IDLE task. */ -extern volatile dq_queue_t g_assignedtasks[CONFIG_SMP_NCPUS]; +extern dq_queue_t g_assignedtasks[CONFIG_SMP_NCPUS]; #endif /* g_running_tasks[] holds a references to the running task for each cpu. @@ -169,22 +169,22 @@ extern FAR struct tcb_s *g_running_tasks[CONFIG_SMP_NCPUS]; * currently active task has disabled pre-emption. */ -extern volatile dq_queue_t g_pendingtasks; +extern dq_queue_t g_pendingtasks; /* This is the list of all tasks that are blocked waiting for a semaphore */ -extern volatile dq_queue_t g_waitingforsemaphore; +extern dq_queue_t g_waitingforsemaphore; /* This is the list of all tasks that are blocked waiting for a signal */ -extern volatile dq_queue_t g_waitingforsignal; +extern dq_queue_t g_waitingforsignal; /* This is the list of all tasks that are blocked waiting for a message * queue to become non-empty. */ #ifndef CONFIG_DISABLE_MQUEUE -extern volatile dq_queue_t g_waitingformqnotempty; +extern dq_queue_t g_waitingformqnotempty; #endif /* This is the list of all tasks that are blocked waiting for a message @@ -192,20 +192,20 @@ extern volatile dq_queue_t g_waitingformqnotempty; */ #ifndef CONFIG_DISABLE_MQUEUE -extern volatile dq_queue_t g_waitingformqnotfull; +extern dq_queue_t g_waitingformqnotfull; #endif /* This is the list of all tasks that are blocking waiting for a page fill */ #ifdef CONFIG_PAGING -extern volatile dq_queue_t g_waitingforfill; +extern dq_queue_t g_waitingforfill; #endif /* This the list of all tasks that have been initialized, but not yet * activated. NOTE: This is the only list that is not prioritized. */ -extern volatile dq_queue_t g_inactivetasks; +extern dq_queue_t g_inactivetasks; /* This is the value of the last process ID assigned to a task */