SMP: Removed unused macros, update comments, update sched_removereadytorun for SMP
This commit is contained in:
parent
c315479a04
commit
76e88c8963
2
arch
2
arch
@ -1 +1 @@
|
|||||||
Subproject commit df987248a73f078f04d532f2b6d2b9ace867926d
|
Subproject commit 717113268b97f16d755a11609a63526dfe71e4cf
|
@ -93,11 +93,9 @@
|
|||||||
#ifdef CONFIG_SMP
|
#ifdef CONFIG_SMP
|
||||||
# define TLIST_HEAD(s,c) \
|
# define TLIST_HEAD(s,c) \
|
||||||
((TLIST_ISINDEXED(s)) ? __TLIST_HEADINDEXED(s,c) : __TLIST_HEAD(s))
|
((TLIST_ISINDEXED(s)) ? __TLIST_HEADINDEXED(s,c) : __TLIST_HEAD(s))
|
||||||
# define TLIST_READYTORUN(s,c) __TLIST_HEADINDEXED(s,c)
|
|
||||||
# define TLIST_BLOCKED(s) __TLIST_HEAD(s)
|
# define TLIST_BLOCKED(s) __TLIST_HEAD(s)
|
||||||
#else
|
#else
|
||||||
# define TLIST_HEAD(s) __TLIST_HEAD(s)
|
# define TLIST_HEAD(s) __TLIST_HEAD(s)
|
||||||
# define TLIST_READYTORUN(s) __TLIST_HEAD(s)
|
|
||||||
# define TLIST_BLOCKED(s) __TLIST_HEAD(s)
|
# define TLIST_BLOCKED(s) __TLIST_HEAD(s)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -45,26 +45,6 @@
|
|||||||
|
|
||||||
#include "sched/sched.h"
|
#include "sched/sched.h"
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Pre-processor Definitions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Type Declarations
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Public Data
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Variables
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Function Prototypes
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@ -73,12 +53,11 @@
|
|||||||
* Name: sched_addreadytorun
|
* Name: sched_addreadytorun
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This function adds a TCB to the ready to run
|
* This function adds a TCB to the ready to run list. If the currently
|
||||||
* list. If the currently active task has preemption disabled
|
* active task has preemption disabled and the new TCB would cause this
|
||||||
* and the new TCB would cause this task to be pre-empted, the
|
* task to be pre-empted, the new task is added to the g_pendingtasks list
|
||||||
* new task is added to the g_pendingtasks list instead. The
|
* instead. Thepending tasks will be made ready-to-run when preemption is
|
||||||
* pending tasks will be made ready-to-run when preemption
|
* unlocked.
|
||||||
* is unlocked.
|
|
||||||
*
|
*
|
||||||
* Inputs:
|
* Inputs:
|
||||||
* btcb - Points to the blocked TCB that is ready-to-run
|
* btcb - Points to the blocked TCB that is ready-to-run
|
||||||
@ -88,13 +67,13 @@
|
|||||||
* has changed.
|
* has changed.
|
||||||
*
|
*
|
||||||
* Assumptions:
|
* Assumptions:
|
||||||
* - The caller has established a critical section before
|
* - The caller has established a critical section before calling this
|
||||||
* calling this function (calling sched_lock() first is NOT
|
* function (calling sched_lock() first is NOT a good idea -- use
|
||||||
* a good idea -- use irqsave()).
|
* irqsave()).
|
||||||
* - The caller has already removed the input rtcb from
|
* - The caller has already removed the input rtcb from whatever list it
|
||||||
* whatever list it was in.
|
* was in.
|
||||||
* - The caller handles the condition that occurs if the
|
* - The caller handles the condition that occurs if the head of the
|
||||||
* the head of the ready-to-run list is changed.
|
* ready-to-run list is changed.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* shced/sched_removereadytorun.c
|
* shced/sched_removereadytorun.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2009, 2012 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007-2009, 2012, 2016 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@ -45,26 +45,6 @@
|
|||||||
|
|
||||||
#include "sched/sched.h"
|
#include "sched/sched.h"
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Pre-processor Definitions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Type Declarations
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Public Data
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Variables
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Function Prototypes
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@ -79,24 +59,25 @@
|
|||||||
* rtcb - Points to the TCB that is ready-to-run
|
* rtcb - Points to the TCB that is ready-to-run
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* true if the currently active task (the head of the
|
* true if the currently active task (the head of the ready-to-run list)
|
||||||
* g_readytorun list) has changed.
|
* has changed.
|
||||||
*
|
*
|
||||||
* Assumptions:
|
* Assumptions:
|
||||||
* - The caller has established a critical section before calling this
|
* - The caller has established a critical section before calling this
|
||||||
* function (calling sched_lock() first is NOT a good idea -- use irqsave()).
|
* function (calling sched_lock() first is NOT a good idea -- use irqsave()).
|
||||||
* - The caller handles the condition that occurs if the
|
* - The caller handles the condition that occurs if the head of the
|
||||||
* the head of the g_readytorun list is changed.
|
* ready-to-run list is changed.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
bool sched_removereadytorun(FAR struct tcb_s *rtcb)
|
bool sched_removereadytorun(FAR struct tcb_s *rtcb)
|
||||||
{
|
{
|
||||||
FAR struct tcb_s *ntcb = NULL;
|
FAR struct tcb_s *ntcb = NULL;
|
||||||
|
FAR dq_queue_t *tasklist;
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
|
|
||||||
/* Check if the TCB to be removed is at the head of the ready to run list.
|
/* Check if the TCB to be removed is at the head of the ready to run list.
|
||||||
* In this case, we are removing the currently active task.
|
* In this case, we are removing the currently active task on this CPU.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!rtcb->blink)
|
if (!rtcb->blink)
|
||||||
@ -113,9 +94,18 @@ bool sched_removereadytorun(FAR struct tcb_s *rtcb)
|
|||||||
ret = true;
|
ret = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Remove the TCB from the ready-to-run list */
|
/* Remove the TCB from the ready-to-run list. In the non-SMP case, this
|
||||||
|
* is always the g_readytorun list; In the SMP case, however, this may be
|
||||||
|
* either the g_readytorun() or the g_assignedtasks[cpu] list.
|
||||||
|
*/
|
||||||
|
|
||||||
dq_rem((FAR dq_entry_t *)rtcb, (FAR dq_queue_t *)&g_readytorun);
|
#ifdef CONFIG_SMP
|
||||||
|
tasklist = TLIST_HEAD(rtcb->task_state, rtcb->cpu);
|
||||||
|
#else
|
||||||
|
tasklist = (FAR dq_queue_t *)&g_readytorun;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
dq_rem((FAR dq_entry_t *)rtcb, tasklist);
|
||||||
|
|
||||||
/* Since the TCB is not in any list, it is now invalid */
|
/* Since the TCB is not in any list, it is now invalid */
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user