You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ma...@apache.org on 2022/08/30 23:51:04 UTC
[incubator-nuttx] 01/02: sched: Remove volatile from the task list
This is an automated email from the ASF dual-hosted git repository.
masayuki pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit a23b30d6250ec7e1440aa106fca0e6cf3ffcd365
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Mon Aug 29 16:39:43 2022 +0800
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 <xi...@xiaomi.com>
---
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 f6bcff4e42..52b13279d1 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 38e60031f5..6110976dc1 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 */