Changeset beab7329 in rtems


Ignore:
Timestamp:
May 13, 2014, 2:03:05 PM (5 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
c6522a65
Parents:
5b1ff71a
git-author:
Sebastian Huber <sebastian.huber@…> (05/13/14 14:03:05)
git-committer:
Sebastian Huber <sebastian.huber@…> (05/14/14 12:46:19)
Message:

score: Introduce scheduler nodes

Rename scheduler per-thread information into scheduler nodes using
Scheduler_Node as the base type. Use inheritance for specialized
schedulers.

Move the scheduler specific states from the thread control block into
the scheduler node structure.

Validate the SMP scheduler node state transitions in case RTEMS_DEBUG is
defined.

Files:
2 added
38 edited

Legend:

Unmodified
Added
Removed
  • cpukit/sapi/include/confdefs.h

    r5b1ff71a rbeab7329  
    24752475    #endif
    24762476    union {
     2477      Scheduler_Node Base;
    24772478      #ifdef CONFIGURE_SCHEDULER_CBS
    2478         Scheduler_CBS_Per_thread CBS;
     2479        Scheduler_CBS_Node CBS;
    24792480      #endif
    24802481      #ifdef CONFIGURE_SCHEDULER_EDF
    2481         Scheduler_EDF_Per_thread EDF;
     2482        Scheduler_EDF_Node EDF;
    24822483      #endif
    2483       #if defined(CONFIGURE_SCHEDULER_PRIORITY) \
    2484         || defined(CONFIGURE_SCHEDULER_PRIORITY_SMP)
    2485         Scheduler_priority_Per_thread Priority;
     2484      #ifdef CONFIGURE_SCHEDULER_PRIORITY
     2485        Scheduler_priority_Node Priority;
     2486      #endif
     2487      #ifdef CONFIGURE_SCHEDULER_SIMPLE_SMP
     2488        Scheduler_SMP_Node Simple_SMP;
     2489      #endif
     2490      #ifdef CONFIGURE_SCHEDULER_PRIORITY_SMP
     2491        Scheduler_priority_SMP_Node Priority_SMP;
    24862492      #endif
    24872493      #ifdef CONFIGURE_SCHEDULER_PRIORITY_AFFINITY_SMP
    2488         Scheduler_priority_affinity_SMP_Per_thread Priority_affinity;
     2494        Scheduler_priority_affinity_SMP_Node Priority_affinity_SMP;
    24892495      #endif
    24902496      #ifdef CONFIGURE_SCHEDULER_USER_PER_THREAD
     
    25122518  const Thread_Control_add_on _Thread_Control_add_ons[] = {
    25132519    {
    2514       offsetof( Configuration_Thread_control, Control.scheduler_info ),
     2520      offsetof( Configuration_Thread_control, Control.scheduler_node ),
    25152521      offsetof( Configuration_Thread_control, Scheduler )
    25162522    }, {
  • cpukit/score/Makefile.am

    r5b1ff71a rbeab7329  
    5353include_rtems_score_HEADERS += include/rtems/score/schedulerimpl.h
    5454include_rtems_score_HEADERS += include/rtems/score/schedulercbs.h
     55include_rtems_score_HEADERS += include/rtems/score/schedulercbsimpl.h
    5556include_rtems_score_HEADERS += include/rtems/score/scheduleredf.h
    5657include_rtems_score_HEADERS += include/rtems/score/scheduleredfimpl.h
     
    127128if HAS_SMP
    128129libscore_a_SOURCES += src/profilingsmplock.c
     130libscore_a_SOURCES += src/schedulersmpvalidstatechanges.c
    129131libscore_a_SOURCES += src/schedulerpriorityaffinitysmp.c
    130132libscore_a_SOURCES += src/schedulerprioritysmp.c
  • cpukit/score/include/rtems/score/scheduler.h

    r5b1ff71a rbeab7329  
    4242
    4343typedef struct Scheduler_Control Scheduler_Control;
     44
     45typedef struct Scheduler_Node Scheduler_Node;
    4446
    4547/**
     
    155157   */
    156158  uint32_t name;
     159};
     160
     161/**
     162 * @brief Scheduler node for per-thread data.
     163 */
     164struct Scheduler_Node {
     165  /* No fields yet */
    157166};
    158167
  • cpukit/score/include/rtems/score/schedulercbs.h

    r5b1ff71a rbeab7329  
    130130typedef struct {
    131131  /** EDF scheduler specific data of a task. */
    132   Scheduler_EDF_Per_thread      edf_per_thread;
     132  Scheduler_EDF_Node            Base;
    133133  /** CBS server specific data of a task. */
    134134  Scheduler_CBS_Server         *cbs_server;
    135 } Scheduler_CBS_Per_thread;
     135} Scheduler_CBS_Node;
    136136
    137137
  • cpukit/score/include/rtems/score/scheduleredf.h

    r5b1ff71a rbeab7329  
    9292
    9393/**
    94  * This structure handles EDF specific data of a thread.
     94 * @brief Scheduler node specialization for EDF schedulers.
    9595 */
    9696typedef struct {
    9797  /**
     98   * @brief Basic scheduler node.
     99   */
     100  Scheduler_Node Base;
     101
     102  /**
    98103   * Pointer to corresponding Thread Control Block.
    99104   */
     
    107112   */
    108113  Scheduler_EDF_Queue_state queue_state;
    109 } Scheduler_EDF_Per_thread;
     114} Scheduler_EDF_Node;
    110115
    111116/**
  • cpukit/score/include/rtems/score/scheduleredfimpl.h

    r5b1ff71a rbeab7329  
    3838}
    3939
     40RTEMS_INLINE_ROUTINE Scheduler_EDF_Node *_Scheduler_EDF_Node_get(
     41  Thread_Control *the_thread
     42)
     43{
     44  return (Scheduler_EDF_Node *) _Scheduler_Node_get( the_thread );
     45}
     46
    4047RTEMS_INLINE_ROUTINE void _Scheduler_EDF_Schedule_body(
    4148  const Scheduler_Control *scheduler,
     
    4754    _Scheduler_EDF_Get_context( scheduler );
    4855  RBTree_Node *first = _RBTree_First( &context->Ready, RBT_LEFT );
    49   Scheduler_EDF_Per_thread *sched_info =
    50     _RBTree_Container_of(first, Scheduler_EDF_Per_thread, Node);
    51   Thread_Control *heir = (Thread_Control *) sched_info->thread;
     56  Scheduler_EDF_Node *node =
     57    _RBTree_Container_of(first, Scheduler_EDF_Node, Node);
     58  Thread_Control *heir = node->thread;
    5259
    5360  ( void ) the_thread;
  • cpukit/score/include/rtems/score/schedulerimpl.h

    r5b1ff71a rbeab7329  
    624624}
    625625
     626RTEMS_INLINE_ROUTINE Scheduler_Node *_Scheduler_Node_get(
     627  Thread_Control *the_thread
     628)
     629{
     630  return the_thread->scheduler_node;
     631}
     632
    626633/** @} */
    627634
  • cpukit/score/include/rtems/score/schedulerpriority.h

    r5b1ff71a rbeab7329  
    8484
    8585/**
    86  * Per-thread data related to the _Scheduler_PRIORITY scheduling policy.
     86 * @brief Data for ready queue operations.
    8787 */
    8888typedef struct {
     
    9292  /** This field contains precalculated priority map indices. */
    9393  Priority_bit_map_Information          Priority_map;
    94 } Scheduler_priority_Per_thread;
     94} Scheduler_priority_Ready_queue;
     95
     96/**
     97 * @brief Scheduler node specialization for Deterministic Priority schedulers.
     98 */
     99typedef struct {
     100  /**
     101   * @brief Basic scheduler node.
     102   */
     103  Scheduler_Node Base;
     104
     105  /**
     106   * @brief The associated ready queue of this node.
     107   */
     108  Scheduler_priority_Ready_queue Ready_queue;
     109} Scheduler_priority_Node;
    95110
    96111/**
  • cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h

    r5b1ff71a rbeab7329  
    119119
    120120/**
    121  * This structure handles affinity specific data of a thread.
    122  *
    123  * @note The attribute priority_sched_info must remain
    124  *       the first element in the structure so that the
    125  *       Scheduler_priority_XXX methods will continue to
    126  *       function.
     121 * @brief Scheduler node specialization for Deterministic Priority Affinity SMP
     122 * schedulers.
    127123 */
    128124typedef struct {
    129 
    130125  /**
    131    * Data for the Priority Scheduler.
     126   * @brief SMP priority scheduler node.
    132127   */
    133   Scheduler_priority_Per_thread  Priority_sched_info;
     128  Scheduler_priority_SMP_Node Base;
    134129
    135130  /**
     
    137132   */
    138133  CPU_set_Control Affinity;
    139 } Scheduler_priority_affinity_SMP_Per_thread;
     134} Scheduler_priority_affinity_SMP_Node;
    140135
    141136/** @} */
  • cpukit/score/include/rtems/score/schedulerpriorityimpl.h

    r5b1ff71a rbeab7329  
    4242}
    4343
     44RTEMS_INLINE_ROUTINE Scheduler_priority_Node *_Scheduler_priority_Node_get(
     45  Thread_Control *the_thread
     46)
     47{
     48  return (Scheduler_priority_Node *) _Scheduler_Node_get( the_thread );
     49}
     50
    4451/**
    4552 * @brief Ready queue initialization.
     
    5865}
    5966
    60 RTEMS_INLINE_ROUTINE Scheduler_priority_Per_thread *
     67RTEMS_INLINE_ROUTINE Scheduler_priority_Node *
    6168_Scheduler_priority_Get_scheduler_info( Thread_Control *thread )
    6269{
    63   return ( Scheduler_priority_Per_thread * ) thread->scheduler_info;
    64 }
    65 
    66 /**
    67  * @brief Put a thread to the ready queue.
    68  *
    69  * This routine puts @a the_thread on to the priority-based ready queue.
     70  return ( Scheduler_priority_Node * ) thread->scheduler_node;
     71}
     72
     73/**
     74 * @brief Enqueues a thread on the specified ready queue.
     75 *
     76 * The thread is placed as the last element of its priority group.
    7077 *
    7178 * @param[in] the_thread The thread to enqueue.
     79 * @param[in] ready_queue The ready queue.
    7280 * @param[in] bit_map The priority bit map of the scheduler instance.
    7381 */
    7482RTEMS_INLINE_ROUTINE void _Scheduler_priority_Ready_queue_enqueue(
    75   Thread_Control           *the_thread,
    76   Priority_bit_map_Control *bit_map
    77 )
    78 {
    79   Scheduler_priority_Per_thread *sched_info_of_thread =
    80     _Scheduler_priority_Get_scheduler_info( the_thread );
    81   Chain_Control *ready_chain = sched_info_of_thread->ready_chain;
     83  Thread_Control                 *the_thread,
     84  Scheduler_priority_Ready_queue *ready_queue,
     85  Priority_bit_map_Control       *bit_map
     86)
     87{
     88  Chain_Control *ready_chain = ready_queue->ready_chain;
    8289
    8390  _Chain_Append_unprotected( ready_chain, &the_thread->Object.Node );
    84   _Priority_bit_map_Add( bit_map, &sched_info_of_thread->Priority_map );
    85 }
    86 
    87 /**
    88  * @brief Put a thread to the head of the ready queue.
    89  *
    90  * This routine puts @a the_thread to the head of the ready queue.
    91  * For priority-based ready queues, the thread will be the first thread
    92  * at its priority level.
    93  *
    94  * @param[in] the_thread The thread to enqueue.
     91  _Priority_bit_map_Add( bit_map, &ready_queue->Priority_map );
     92}
     93
     94/**
     95 * @brief Enqueues a thread on the specified ready queue as first.
     96 *
     97 * The thread is placed as the first element of its priority group.
     98 *
     99 * @param[in] the_thread The thread to enqueue as first.
     100 * @param[in] ready_queue The ready queue.
    95101 * @param[in] bit_map The priority bit map of the scheduler instance.
    96102 */
    97103RTEMS_INLINE_ROUTINE void _Scheduler_priority_Ready_queue_enqueue_first(
    98   Thread_Control           *the_thread,
    99   Priority_bit_map_Control *bit_map
    100 )
    101 {
    102   Scheduler_priority_Per_thread *sched_info_of_thread =
    103     _Scheduler_priority_Get_scheduler_info( the_thread );
    104   Chain_Control *ready_chain = sched_info_of_thread->ready_chain;
     104  Thread_Control                 *the_thread,
     105  Scheduler_priority_Ready_queue *ready_queue,
     106  Priority_bit_map_Control       *bit_map
     107)
     108{
     109  Chain_Control *ready_chain = ready_queue->ready_chain;
    105110
    106111  _Chain_Prepend_unprotected( ready_chain, &the_thread->Object.Node );
    107   _Priority_bit_map_Add( bit_map, &sched_info_of_thread->Priority_map );
    108 }
    109 
    110 /**
    111  * @brief Remove a specific thread from the ready queue.
    112  *
    113  * This routine removes a specific thread from the specified
    114  * priority-based ready queue.
     112  _Priority_bit_map_Add( bit_map, &ready_queue->Priority_map );
     113}
     114
     115/**
     116 * @brief Extracts a thread from the specified ready queue.
    115117 *
    116118 * @param[in] the_thread The thread to extract.
     119 * @param[in] ready_queue The ready queue.
    117120 * @param[in] bit_map The priority bit map of the scheduler instance.
    118121 */
    119122RTEMS_INLINE_ROUTINE void _Scheduler_priority_Ready_queue_extract(
    120   Thread_Control           *the_thread,
    121   Priority_bit_map_Control *bit_map
    122 )
    123 {
    124   Scheduler_priority_Per_thread *sched_info_of_thread =
    125     _Scheduler_priority_Get_scheduler_info( the_thread );
    126   Chain_Control *ready_chain = sched_info_of_thread->ready_chain;
     123  Thread_Control                 *the_thread,
     124  Scheduler_priority_Ready_queue *ready_queue,
     125  Priority_bit_map_Control       *bit_map
     126)
     127{
     128  Chain_Control *ready_chain = ready_queue->ready_chain;
    127129
    128130  if ( _Chain_Has_only_one_node( ready_chain ) ) {
    129131    _Chain_Initialize_empty( ready_chain );
    130     _Priority_bit_map_Remove( bit_map, &sched_info_of_thread->Priority_map );
     132    _Priority_bit_map_Remove( bit_map, &ready_queue->Priority_map );
    131133  } else {
    132134    _Chain_Extract_unprotected( &the_thread->Object.Node );
     
    141143  Scheduler_priority_Context *context =
    142144    _Scheduler_priority_Get_context( scheduler );
    143 
    144   _Scheduler_priority_Ready_queue_extract( the_thread, &context->Bit_map );
     145  Scheduler_priority_Node *node = _Scheduler_priority_Node_get( the_thread );
     146
     147  _Scheduler_priority_Ready_queue_extract(
     148    the_thread,
     149    &node->Ready_queue,
     150    &context->Bit_map
     151  );
    145152}
    146153
     
    166173
    167174/**
    168  * @brief Requeue a thread on the ready queue.
     175 * @brief Requeues a thread on the specified ready queue.
    169176 *
    170177 * This routine is invoked when a thread changes priority and should be
    171178 * moved to a different position on the ready queue.
    172179 *
    173  * @param[in] the_thread is a pointer to the thread
     180 * @param[in] the_thread The thread to requeue.
     181 * @param[in] ready_queue The ready queue.
    174182 */
    175183RTEMS_INLINE_ROUTINE void _Scheduler_priority_Ready_queue_requeue(
    176   Thread_Control            *the_thread
    177 )
    178 {
    179   Scheduler_priority_Per_thread *sched_info_of_thread =
    180     _Scheduler_priority_Get_scheduler_info( the_thread );
    181   Chain_Control *ready_chain = sched_info_of_thread->ready_chain;
     184  Thread_Control                 *the_thread,
     185  Scheduler_priority_Ready_queue *ready_queue
     186)
     187{
     188  Chain_Control *ready_chain = ready_queue->ready_chain;
    182189
    183190  if ( !_Chain_Has_only_one_node( ready_chain ) ) {
     
    211218}
    212219
    213 RTEMS_INLINE_ROUTINE void _Scheduler_priority_Update_body(
    214   Thread_Control           *thread,
    215   Priority_bit_map_Control *bit_map,
    216   Chain_Control            *ready_queues
    217 )
    218 {
    219   Scheduler_priority_Per_thread *sched_info_of_thread =
    220     _Scheduler_priority_Get_scheduler_info( thread );
    221 
    222   sched_info_of_thread->ready_chain =
    223     &ready_queues[ thread->current_priority ];
     220/**
     221 * @brief Updates the specified ready queue data according to the current
     222 * priority of the thread.
     223 *
     224 * @param[in] the_thread The thread.
     225 * @param[in] ready_queue The ready queue.
     226 * @param[in] bit_map The priority bit map of the scheduler instance.
     227 * @param[in] ready_queues The ready queues of the scheduler instance.
     228 */
     229RTEMS_INLINE_ROUTINE void _Scheduler_priority_Ready_queue_update(
     230  Thread_Control                 *the_thread,
     231  Scheduler_priority_Ready_queue *ready_queue,
     232  Priority_bit_map_Control       *bit_map,
     233  Chain_Control                  *ready_queues
     234)
     235{
     236  Priority_Control priority = the_thread->current_priority;
     237  ready_queue->ready_chain = &ready_queues[ priority ];
    224238
    225239  _Priority_bit_map_Initialize_information(
    226240    bit_map,
    227     &sched_info_of_thread->Priority_map,
    228     thread->current_priority
     241    &ready_queue->Priority_map,
     242    priority
    229243  );
    230244}
  • cpukit/score/include/rtems/score/schedulerprioritysmp.h

    r5b1ff71a rbeab7329  
    4848 */
    4949
     50/**
     51 * @brief Scheduler context specialization for Deterministic Priority SMP
     52 * schedulers.
     53 */
    5054typedef struct {
    5155  Scheduler_SMP_Context    Base;
    5256  Priority_bit_map_Control Bit_map;
    53   Chain_Control            Ready[ 0 ];
     57  Chain_Control            Ready[ RTEMS_ZERO_LENGTH_ARRAY ];
    5458} Scheduler_priority_SMP_Context;
     59
     60/**
     61 * @brief Scheduler node specialization for Deterministic Priority SMP
     62 * schedulers.
     63 */
     64typedef struct {
     65  /**
     66   * @brief SMP scheduler node.
     67   */
     68  Scheduler_SMP_Node Base;
     69
     70  /**
     71   * @brief The associated ready queue of this node.
     72   */
     73  Scheduler_priority_Ready_queue Ready_queue;
     74} Scheduler_priority_SMP_Node;
    5575
    5676/**
     
    6484    _Scheduler_priority_SMP_Block, \
    6585    _Scheduler_priority_SMP_Enqueue_fifo, \
    66     _Scheduler_default_Allocate, \
     86    _Scheduler_priority_SMP_Allocate, \
    6787    _Scheduler_default_Free, \
    6888    _Scheduler_priority_SMP_Update, \
     
    7999
    80100void _Scheduler_priority_SMP_Initialize( const Scheduler_Control *scheduler );
     101
     102bool _Scheduler_priority_SMP_Allocate(
     103  const Scheduler_Control *scheduler,
     104  Thread_Control *thread
     105);
    81106
    82107void _Scheduler_priority_SMP_Schedule(
  • cpukit/score/include/rtems/score/schedulersimplesmp.h

    r5b1ff71a rbeab7329  
    6565    _Scheduler_simple_smp_Block, \
    6666    _Scheduler_simple_smp_Enqueue_priority_fifo, \
    67     _Scheduler_default_Allocate, \
     67    _Scheduler_simple_smp_Allocate, \
    6868    _Scheduler_default_Free, \
    6969    _Scheduler_default_Update, \
     
    8080
    8181void _Scheduler_simple_smp_Initialize( const Scheduler_Control *scheduler );
     82
     83bool _Scheduler_simple_smp_Allocate(
     84  const Scheduler_Control *scheduler,
     85  Thread_Control          *the_thread
     86);
    8287
    8388void _Scheduler_simple_smp_Block(
  • cpukit/score/include/rtems/score/schedulersmp.h

    r5b1ff71a rbeab7329  
    3939 */
    4040
     41/**
     42 * @brief Scheduler context specialization for SMP schedulers.
     43 */
    4144typedef struct {
    4245  /**
     
    4548  Scheduler_Context Base;
    4649
     50  /**
     51   * @brief The chain of scheduled nodes.
     52   */
    4753  Chain_Control Scheduled;
    4854} Scheduler_SMP_Context;
     55
     56/**
     57 * @brief SMP scheduler node states.
     58 */
     59typedef enum {
     60  /**
     61   * @brief This scheduler node is blocked.
     62   *
     63   * A scheduler node is blocked if the corresponding thread is not ready.
     64   */
     65  SCHEDULER_SMP_NODE_BLOCKED,
     66
     67  /**
     68   * @brief The scheduler node is scheduled.
     69   *
     70   * A scheduler node is scheduled if the corresponding thread is ready and the
     71   * scheduler allocated a processor for it.  A scheduled node is assigned to
     72   * exactly one processor.  The sum of scheduled and in the air nodes equals
     73   * the processor count owned by a scheduler instance.
     74   */
     75  SCHEDULER_SMP_NODE_SCHEDULED,
     76
     77  /**
     78   * @brief This scheduler node is ready.
     79   *
     80   * A scheduler node is ready if the corresponding thread is ready and the
     81   * scheduler did not allocate a processor for it.
     82   */
     83  SCHEDULER_SMP_NODE_READY,
     84
     85  /**
     86   * @brief This scheduler node is in the air.
     87   *
     88   * A scheduled node is in the air if it has an allocated processor and the
     89   * corresponding thread is in a transient state.  Such a node is not an
     90   * element of the set of scheduled nodes.  The extract operation on a
     91   * scheduled node will produce a scheduler node in the air (see also
     92   * _Thread_Set_transient()).  The next enqueue or schedule operation will
     93   * decide what to do based on this state indication.  It can either place the
     94   * scheduler node back on the set of scheduled nodes and the thread can keep
     95   * its allocated processor, or it can take the processor away from the thread
     96   * and give the processor to another thread of higher priority.
     97   */
     98  SCHEDULER_SMP_NODE_IN_THE_AIR
     99} Scheduler_SMP_Node_state;
     100
     101/**
     102 * @brief Scheduler node specialization for SMP schedulers.
     103 */
     104typedef struct {
     105  /**
     106   * @brief Basic scheduler node.
     107   */
     108  Scheduler_Node Base;
     109
     110  /**
     111   * @brief The state of this node.
     112   */
     113  Scheduler_SMP_Node_state state;
     114} Scheduler_SMP_Node;
    49115
    50116/** @} */
  • cpukit/score/include/rtems/score/schedulersmpimpl.h

    r5b1ff71a rbeab7329  
    6363{
    6464  _Chain_Initialize_empty( &self->Scheduled );
     65}
     66
     67static inline Scheduler_SMP_Node *_Scheduler_SMP_Node_get(
     68  Thread_Control *thread
     69)
     70{
     71  return (Scheduler_SMP_Node *) _Scheduler_Node_get( thread );
     72}
     73
     74static inline void _Scheduler_SMP_Node_initialize(
     75  Scheduler_SMP_Node *node
     76)
     77{
     78  node->state = SCHEDULER_SMP_NODE_BLOCKED;
     79}
     80
     81extern const bool _Scheduler_SMP_Node_valid_state_changes[ 4 ][ 4 ];
     82
     83static inline void _Scheduler_SMP_Node_change_state(
     84  Scheduler_SMP_Node *node,
     85  Scheduler_SMP_Node_state new_state
     86)
     87{
     88  _Assert(
     89    _Scheduler_SMP_Node_valid_state_changes[ node->state ][ new_state ]
     90  );
     91
     92  node->state = new_state;
    6593}
    6694
     
    107135)
    108136{
     137  Scheduler_SMP_Node *scheduled_node = _Scheduler_SMP_Node_get( scheduled );
    109138  Per_CPU_Control *cpu_of_scheduled = _Thread_Get_CPU( scheduled );
    110139  Per_CPU_Control *cpu_of_victim = _Thread_Get_CPU( victim );
     
    112141  Thread_Control *heir;
    113142
    114   scheduled->is_scheduled = true;
    115   victim->is_scheduled = false;
     143  _Scheduler_SMP_Node_change_state(
     144    scheduled_node,
     145    SCHEDULER_SMP_NODE_SCHEDULED
     146  );
    116147
    117148  _Assert( _ISR_Get_level() != 0 );
     
    161192)
    162193{
    163   if ( thread->is_in_the_air ) {
     194  Scheduler_SMP_Node *node = _Scheduler_SMP_Node_get( thread );
     195
     196  if ( node->state == SCHEDULER_SMP_NODE_IN_THE_AIR ) {
    164197    Thread_Control *highest_ready = ( *get_highest_ready )( self );
    165 
    166     thread->is_in_the_air = false;
    167198
    168199    /*
     
    176207        && !( *order )( &thread->Object.Node, &highest_ready->Object.Node )
    177208    ) {
     209      _Scheduler_SMP_Node_change_state( node, SCHEDULER_SMP_NODE_READY );
    178210      _Scheduler_SMP_Allocate_processor( self, highest_ready, thread );
    179 
    180211      ( *insert_ready )( self, thread );
    181212      ( *move_from_ready_to_scheduled )( self, highest_ready );
    182213    } else {
    183       thread->is_scheduled = true;
    184 
     214      _Scheduler_SMP_Node_change_state( node, SCHEDULER_SMP_NODE_SCHEDULED );
    185215      ( *insert_scheduled )( self, thread );
    186216    }
     
    196226        && ( *order )( &thread->Object.Node, &lowest_scheduled->Object.Node )
    197227    ) {
     228      Scheduler_SMP_Node *lowest_scheduled_node =
     229        _Scheduler_SMP_Node_get( lowest_scheduled );
     230
     231      _Scheduler_SMP_Node_change_state(
     232        lowest_scheduled_node,
     233        SCHEDULER_SMP_NODE_READY
     234      );
    198235      _Scheduler_SMP_Allocate_processor( self, thread, lowest_scheduled );
    199 
    200236      ( *insert_scheduled )( self, thread );
    201237      ( *move_from_scheduled_to_ready )( self, lowest_scheduled );
    202238    } else {
     239      _Scheduler_SMP_Node_change_state( node, SCHEDULER_SMP_NODE_READY );
    203240      ( *insert_ready )( self, thread );
    204241    }
     
    227264)
    228265{
    229   if ( thread->is_in_the_air ) {
    230     thread->is_in_the_air = false;
     266  Scheduler_SMP_Node *node = _Scheduler_SMP_Node_get( thread );
     267
     268  if ( node->state == SCHEDULER_SMP_NODE_IN_THE_AIR ) {
     269    _Scheduler_SMP_Node_change_state( node, SCHEDULER_SMP_NODE_BLOCKED );
    231270
    232271    _Scheduler_SMP_Schedule_highest_ready(
     
    296335)
    297336{
    298   thread->is_scheduled = true;
     337  Scheduler_SMP_Node *node = _Scheduler_SMP_Node_get( thread );
     338
     339  node->state = SCHEDULER_SMP_NODE_SCHEDULED;
     340
    299341  _Thread_Set_CPU( thread, cpu );
    300342  _Chain_Append_unprotected( &self->Scheduled, &thread->Object.Node );
  • cpukit/score/include/rtems/score/thread.h

    r5b1ff71a rbeab7329  
    3939
    4040struct Scheduler_Control;
     41
     42struct Scheduler_Node;
    4143
    4244#ifdef __cplusplus
     
    480482#if defined(RTEMS_SMP)
    481483  /**
    482    * @brief This field is true if the thread is scheduled.
    483    *
    484    * A thread is scheduled if it is ready and the scheduler allocated a
    485    * processor for it.  A scheduled thread is assigned to exactly one
    486    * processor.  There are exactly processor count scheduled threads in the
    487    * system.
    488    */
    489   bool                                  is_scheduled;
    490 
    491   /**
    492    * @brief This field is true if the thread is in the air.
    493    *
    494    * A thread is in the air if it has an allocated processor (it is an
    495    * executing or heir thread on exactly one processor) and it is not a member
    496    * of the scheduled chain.  The extract operation on a scheduled thread will
    497    * produce threads in the air (see also _Thread_Set_transient()).  The next
    498    * enqueue or schedule operation will decide what to do based on this state
    499    * indication.  It can either place the thread back on the scheduled chain
    500    * and the thread can keep its allocated processor, or it can take the
    501    * processor away from the thread and give the processor to another thread of
    502    * higher priority.
    503    */
    504   bool                                  is_in_the_air;
    505 
    506   /**
    507484   * @brief The scheduler of this thread.
    508485   */
     
    531508  Thread_CPU_usage_t                    cpu_time_used;
    532509
    533   /** This pointer holds per-thread data for the scheduler and ready queue. */
    534   void                                 *scheduler_info;
     510  /**
     511   * @brief The scheduler node of this thread for the real scheduler.
     512   */
     513  struct Scheduler_Node                *scheduler_node;
    535514
    536515#ifdef RTEMS_SMP
  • cpukit/score/preinstall.am

    r5b1ff71a rbeab7329  
    191191        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/schedulercbs.h
    192192PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/schedulercbs.h
     193
     194$(PROJECT_INCLUDE)/rtems/score/schedulercbsimpl.h: include/rtems/score/schedulercbsimpl.h $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
     195        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/schedulercbsimpl.h
     196PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/schedulercbsimpl.h
    193197
    194198$(PROJECT_INCLUDE)/rtems/score/scheduleredf.h: include/rtems/score/scheduleredf.h $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
  • cpukit/score/src/schedulercbs.c

    r5b1ff71a rbeab7329  
    1919#endif
    2020
    21 #include <rtems/score/schedulercbs.h>
     21#include <rtems/score/schedulercbsimpl.h>
    2222#include <rtems/score/threadimpl.h>
    2323#include <rtems/score/wkspace.h>
     
    2828{
    2929  Priority_Control          new_priority;
    30   Scheduler_CBS_Per_thread *sched_info;
     30  Scheduler_CBS_Node       *node;
    3131  Scheduler_CBS_Server_id   server_id;
    3232
     
    3939
    4040  /* Invoke callback function if any. */
    41   sched_info = (Scheduler_CBS_Per_thread *) the_thread->scheduler_info;
    42   if ( sched_info->cbs_server->cbs_budget_overrun ) {
     41  node = _Scheduler_CBS_Node_get( the_thread );
     42  if ( node->cbs_server->cbs_budget_overrun ) {
    4343    _Scheduler_CBS_Get_server_id(
    44         sched_info->cbs_server->task_id,
     44        node->cbs_server->task_id,
    4545        &server_id
    4646    );
    47     sched_info->cbs_server->cbs_budget_overrun( server_id );
     47    node->cbs_server->cbs_budget_overrun( server_id );
    4848  }
    4949}
  • cpukit/score/src/schedulercbsallocate.c

    r5b1ff71a rbeab7329  
    1919#endif
    2020
    21 #include <rtems/system.h>
    22 #include <rtems/config.h>
    23 #include <rtems/score/scheduler.h>
    24 #include <rtems/score/scheduleredf.h>
    25 #include <rtems/score/schedulercbs.h>
    26 #include <rtems/score/wkspace.h>
     21#include <rtems/score/schedulercbsimpl.h>
    2722
    2823bool _Scheduler_CBS_Allocate(
     
    3126)
    3227{
    33   Scheduler_CBS_Per_thread *schinfo = the_thread->scheduler_info;
     28  Scheduler_CBS_Node *node = _Scheduler_CBS_Node_get( the_thread );
    3429
    3530  (void) scheduler;
    3631
    37   schinfo->edf_per_thread.thread = the_thread;
    38   schinfo->edf_per_thread.queue_state = SCHEDULER_EDF_QUEUE_STATE_NEVER_HAS_BEEN;
    39   schinfo->cbs_server = NULL;
     32  node->Base.thread = the_thread;
     33  node->Base.queue_state = SCHEDULER_EDF_QUEUE_STATE_NEVER_HAS_BEEN;
     34  node->cbs_server = NULL;
    4035
    4136  return true;
  • cpukit/score/src/schedulercbsattachthread.c

    r5b1ff71a rbeab7329  
    1919#endif
    2020
    21 #include <rtems/score/schedulercbs.h>
     21#include <rtems/score/schedulercbsimpl.h>
    2222#include <rtems/score/threadimpl.h>
    2323
     
    4444  /* The routine _Thread_Get may disable dispatch and not enable again. */
    4545  if ( the_thread ) {
    46     Scheduler_CBS_Per_thread *sched_info;
    47 
    48     sched_info = (Scheduler_CBS_Per_thread *) the_thread->scheduler_info;
     46    Scheduler_CBS_Node *node = _Scheduler_CBS_Node_get( the_thread );
    4947
    5048    /* Thread is already attached to a server. */
    51     if ( sched_info->cbs_server ) {
     49    if ( node->cbs_server ) {
    5250      _Objects_Put( &the_thread->Object );
    5351      return SCHEDULER_CBS_ERROR_FULL;
     
    5553
    5654    _Scheduler_CBS_Server_list[server_id].task_id = task_id;
    57     sched_info->cbs_server = &_Scheduler_CBS_Server_list[server_id];
     55    node->cbs_server = &_Scheduler_CBS_Server_list[server_id];
    5856
    5957    the_thread->budget_callout   = _Scheduler_CBS_Budget_callout;
  • cpukit/score/src/schedulercbsdetachthread.c

    r5b1ff71a rbeab7329  
    2020#endif
    2121
    22 #include <rtems/score/schedulercbs.h>
     22#include <rtems/score/schedulercbsimpl.h>
    2323#include <rtems/score/threadimpl.h>
    2424
     
    3030  Objects_Locations location;
    3131  Thread_Control *the_thread;
    32   Scheduler_CBS_Per_thread *sched_info;
    3332
    3433  if ( server_id >= _Scheduler_CBS_Maximum_servers )
     
    4443  /* The routine _Thread_Get may disable dispatch and not enable again. */
    4544  if ( the_thread ) {
     45    Scheduler_CBS_Node *node = _Scheduler_CBS_Node_get( the_thread );
     46
    4647    _Scheduler_CBS_Server_list[server_id].task_id = -1;
    47     sched_info = (Scheduler_CBS_Per_thread *) the_thread->scheduler_info;
    48     sched_info->cbs_server = NULL;
     48    node->cbs_server = NULL;
    4949
    5050    the_thread->budget_algorithm = the_thread->Start.budget_algorithm;
  • cpukit/score/src/schedulercbsreleasejob.c

    r5b1ff71a rbeab7329  
    2020#endif
    2121
    22 #include <rtems/score/schedulercbs.h>
     22#include <rtems/score/schedulercbsimpl.h>
    2323#include <rtems/score/threadimpl.h>
    2424#include <rtems/score/watchdogimpl.h>
     
    3030)
    3131{
    32   Priority_Control new_priority;
    33   Scheduler_CBS_Per_thread *sched_info =
    34     (Scheduler_CBS_Per_thread *) the_thread->scheduler_info;
    35   Scheduler_CBS_Server *serv_info =
    36     (Scheduler_CBS_Server *) sched_info->cbs_server;
     32  Scheduler_CBS_Node   *node = _Scheduler_CBS_Node_get( the_thread );
     33  Scheduler_CBS_Server *serv_info = node->cbs_server;
     34  Priority_Control      new_priority;
    3735
    3836  if (deadline) {
  • cpukit/score/src/schedulercbsunblock.c

    r5b1ff71a rbeab7329  
    2020#endif
    2121
    22 #include <rtems/score/schedulercbs.h>
     22#include <rtems/score/schedulercbsimpl.h>
    2323#include <rtems/score/schedulerimpl.h>
    2424#include <rtems/score/threadimpl.h>
     
    3030)
    3131{
    32   Scheduler_CBS_Per_thread *sched_info;
    33   Scheduler_CBS_Server *serv_info;
    34   Priority_Control new_priority;
     32  Scheduler_CBS_Node   *node = _Scheduler_CBS_Node_get( the_thread );
     33  Scheduler_CBS_Server *serv_info = node->cbs_server;
     34  Priority_Control      new_priority;
    3535
    3636  _Scheduler_EDF_Enqueue( scheduler, the_thread );
    3737  /* TODO: flash critical section? */
    38 
    39   sched_info = (Scheduler_CBS_Per_thread *) the_thread->scheduler_info;
    40   serv_info = (Scheduler_CBS_Server *) sched_info->cbs_server;
    4138
    4239  /*
  • cpukit/score/src/scheduleredf.c

    r5b1ff71a rbeab7329  
    2828{
    2929  Priority_Control value1 = _RBTree_Container_of
    30     (n1,Scheduler_EDF_Per_thread,Node)->thread->current_priority;
     30    (n1,Scheduler_EDF_Node,Node)->thread->current_priority;
    3131  Priority_Control value2 = _RBTree_Container_of
    32     (n2,Scheduler_EDF_Per_thread,Node)->thread->current_priority;
     32    (n2,Scheduler_EDF_Node,Node)->thread->current_priority;
    3333
    3434  /*
  • cpukit/score/src/scheduleredfallocate.c

    r5b1ff71a rbeab7329  
    1919#endif
    2020
    21 #include <rtems/system.h>
    22 #include <rtems/config.h>
    23 #include <rtems/score/scheduler.h>
    24 #include <rtems/score/scheduleredf.h>
    25 #include <rtems/score/wkspace.h>
     21#include <rtems/score/scheduleredfimpl.h>
    2622
    2723bool _Scheduler_EDF_Allocate(
     
    3026)
    3127{
    32   Scheduler_EDF_Per_thread *schinfo = the_thread->scheduler_info;
     28  Scheduler_EDF_Node *node = _Scheduler_EDF_Node_get( the_thread );
    3329
    3430  (void) scheduler;
    3531
    36   schinfo = (Scheduler_EDF_Per_thread *)(the_thread->scheduler_info);
    37   schinfo->thread = the_thread;
    38   schinfo->queue_state = SCHEDULER_EDF_QUEUE_STATE_NEVER_HAS_BEEN;
     32  node->thread = the_thread;
     33  node->queue_state = SCHEDULER_EDF_QUEUE_STATE_NEVER_HAS_BEEN;
    3934
    4035  return true;
  • cpukit/score/src/scheduleredfenqueue.c

    r5b1ff71a rbeab7329  
    2828  Scheduler_EDF_Context *context =
    2929    _Scheduler_EDF_Get_context( scheduler );
    30   Scheduler_EDF_Per_thread *sched_info =
    31     (Scheduler_EDF_Per_thread*) the_thread->scheduler_info;
    32   RBTree_Node *node = &(sched_info->Node);
     30  Scheduler_EDF_Node *node = _Scheduler_EDF_Node_get( the_thread );
    3331
    34   _RBTree_Insert( &context->Ready, node );
    35   sched_info->queue_state = SCHEDULER_EDF_QUEUE_STATE_YES;
     32  _RBTree_Insert( &context->Ready, &node->Node );
     33  node->queue_state = SCHEDULER_EDF_QUEUE_STATE_YES;
    3634}
  • cpukit/score/src/scheduleredfextract.c

    r5b1ff71a rbeab7329  
    2828  Scheduler_EDF_Context *context =
    2929    _Scheduler_EDF_Get_context( scheduler );
    30   Scheduler_EDF_Per_thread *sched_info =
    31     (Scheduler_EDF_Per_thread*) the_thread->scheduler_info;
    32   RBTree_Node *node = &(sched_info->Node);
     30  Scheduler_EDF_Node *node = _Scheduler_EDF_Node_get( the_thread );
    3331
    34   _RBTree_Extract( &context->Ready, node );
    35   sched_info->queue_state = SCHEDULER_EDF_QUEUE_STATE_NOT_PRESENTLY;
     32  _RBTree_Extract( &context->Ready, &node->Node );
     33  node->queue_state = SCHEDULER_EDF_QUEUE_STATE_NOT_PRESENTLY;
    3634}
  • cpukit/score/src/scheduleredfupdate.c

    r5b1ff71a rbeab7329  
    1919#endif
    2020
    21 #include <rtems/system.h>
    22 #include <rtems/config.h>
    23 #include <rtems/score/priority.h>
    24 #include <rtems/score/scheduler.h>
    25 #include <rtems/score/scheduleredf.h>
    26 #include <rtems/score/thread.h>
     21#include <rtems/score/scheduleredfimpl.h>
    2722
    2823void _Scheduler_EDF_Update(
     
    3126)
    3227{
    33   Scheduler_EDF_Per_thread *sched_info =
    34     (Scheduler_EDF_Per_thread*)the_thread->scheduler_info;
     28  Scheduler_EDF_Node *node = _Scheduler_EDF_Node_get( the_thread );
    3529
    3630  (void) scheduler;
    3731
    38   if (sched_info->queue_state == SCHEDULER_EDF_QUEUE_STATE_NEVER_HAS_BEEN) {
     32  if (node->queue_state == SCHEDULER_EDF_QUEUE_STATE_NEVER_HAS_BEEN) {
    3933    /* Shifts the priority to the region of background tasks. */
    4034    the_thread->Start.initial_priority |= (SCHEDULER_EDF_PRIO_MSB);
    4135    the_thread->real_priority    = the_thread->Start.initial_priority;
    4236    the_thread->current_priority = the_thread->Start.initial_priority;
    43     sched_info->queue_state = SCHEDULER_EDF_QUEUE_STATE_NOT_PRESENTLY;
     37    node->queue_state = SCHEDULER_EDF_QUEUE_STATE_NOT_PRESENTLY;
    4438  }
    4539}
  • cpukit/score/src/scheduleredfyield.c

    r5b1ff71a rbeab7329  
    2929  Scheduler_EDF_Context *context =
    3030    _Scheduler_EDF_Get_context( scheduler );
     31  Scheduler_EDF_Node    *node = _Scheduler_EDF_Node_get( the_thread );
    3132  ISR_Level              level;
    32 
    33   Scheduler_EDF_Per_thread *thread_info =
    34     (Scheduler_EDF_Per_thread *) the_thread->scheduler_info;
    35   RBTree_Node *thread_node = &(thread_info->Node);
    3633
    3734  _ISR_Disable( level );
     
    4138   * with the same priority in case there are such ones.
    4239   */
    43   _RBTree_Extract( &context->Ready, thread_node );
    44   _RBTree_Insert( &context->Ready, thread_node );
     40  _RBTree_Extract( &context->Ready, &node->Node );
     41  _RBTree_Insert( &context->Ready, &node->Node );
    4542
    4643  _ISR_Flash( level );
  • cpukit/score/src/schedulerpriorityaffinitysmp.c

    r5b1ff71a rbeab7329  
    2626#include <rtems/score/cpusetimpl.h>
    2727
    28 RTEMS_INLINE_ROUTINE Scheduler_priority_affinity_SMP_Per_thread *
    29 _Scheduler_priority_affinity_Get_scheduler_info( Thread_Control *thread )
     28static Scheduler_priority_affinity_SMP_Node *
     29_Scheduler_priority_affinity_Node_get( Thread_Control *thread )
    3030{
    31   return ( Scheduler_priority_affinity_SMP_Per_thread * ) thread->scheduler_info;
     31  return ( Scheduler_priority_affinity_SMP_Node * )
     32    _Scheduler_Node_get( thread );
    3233}
    3334
     
    3738)
    3839{
    39   Scheduler_priority_affinity_SMP_Per_thread *info =
    40     the_thread->scheduler_info;
     40  Scheduler_priority_affinity_SMP_Node *node =
     41    _Scheduler_priority_affinity_Node_get( the_thread );
    4142
    42   info->Affinity = *_CPU_set_Default();
    43   info->Affinity.set = &info->Affinity.preallocated;
     43  _Scheduler_SMP_Node_initialize( &node->Base.Base );
     44
     45  node->Affinity = *_CPU_set_Default();
     46  node->Affinity.set = &node->Affinity.preallocated;
    4447
    4548  return true;
     
    5356)
    5457{
    55   Scheduler_priority_affinity_SMP_Per_thread *info =
    56     _Scheduler_priority_affinity_Get_scheduler_info(thread);
     58  Scheduler_priority_affinity_SMP_Node *node =
     59    _Scheduler_priority_affinity_Node_get(thread);
    5760
    5861  (void) scheduler;
    5962
    60   if ( info->Affinity.setsize != cpusetsize ) {
     63  if ( node->Affinity.setsize != cpusetsize ) {
    6164    return false;
    6265  }
    6366
    64   CPU_COPY( cpuset, info->Affinity.set );
     67  CPU_COPY( cpuset, node->Affinity.set );
    6568  return true;
    6669}
     
    7376)
    7477{
    75   Scheduler_priority_affinity_SMP_Per_thread *info =
    76     _Scheduler_priority_affinity_Get_scheduler_info(thread);
     78  Scheduler_priority_affinity_SMP_Node *node =
     79    _Scheduler_priority_affinity_Node_get(thread);
    7780
    7881  (void) scheduler;
     
    8285  }
    8386
    84   CPU_COPY( info->Affinity.set, cpuset );
     87  CPU_COPY( node->Affinity.set, cpuset );
    8588 
    8689  return true;
  • cpukit/score/src/schedulerpriorityenqueue.c

    r5b1ff71a rbeab7329  
    2828  Scheduler_priority_Context *context =
    2929    _Scheduler_priority_Get_context( scheduler );
     30  Scheduler_priority_Node *node = _Scheduler_priority_Node_get( the_thread );
    3031
    31   _Scheduler_priority_Ready_queue_enqueue( the_thread, &context->Bit_map );
     32  _Scheduler_priority_Ready_queue_enqueue(
     33    the_thread,
     34    &node->Ready_queue,
     35    &context->Bit_map
     36  );
    3237}
  • cpukit/score/src/schedulerpriorityenqueuefirst.c

    r5b1ff71a rbeab7329  
    2828  Scheduler_priority_Context *context =
    2929    _Scheduler_priority_Get_context( scheduler );
     30  Scheduler_priority_Node *node = _Scheduler_priority_Node_get( the_thread );
    3031
    3132  _Scheduler_priority_Ready_queue_enqueue_first(
    3233    the_thread,
     34    &node->Ready_queue,
    3335    &context->Bit_map
    3436  );
  • cpukit/score/src/schedulerprioritysmp.c

    r5b1ff71a rbeab7329  
    22 * @file
    33 *
     4 * @ingroup ScoreSchedulerPrioritySMP
     5 *
    46 * @brief Deterministic Priority SMP Scheduler Implementation
    5  *
    6  * @ingroup ScoreSchedulerSMP
    77 */
    88
     
    4444}
    4545
     46static Scheduler_priority_SMP_Node *_Scheduler_priority_SMP_Node_get(
     47  Thread_Control *thread
     48)
     49{
     50  return (Scheduler_priority_SMP_Node *) _Scheduler_Node_get( thread );
     51}
     52
    4653void _Scheduler_priority_SMP_Initialize( const Scheduler_Control *scheduler )
    4754{
     
    5461}
    5562
     63bool _Scheduler_priority_SMP_Allocate(
     64  const Scheduler_Control *scheduler,
     65  Thread_Control *thread
     66)
     67{
     68  Scheduler_SMP_Node *node = _Scheduler_SMP_Node_get( thread );
     69
     70  _Scheduler_SMP_Node_initialize( node );
     71
     72  return true;
     73}
     74
    5675void _Scheduler_priority_SMP_Update(
    5776  const Scheduler_Control *scheduler,
     
    6180  Scheduler_priority_SMP_Context *self =
    6281    _Scheduler_priority_SMP_Get_context( scheduler );
    63 
    64   _Scheduler_priority_Update_body(
    65     thread,
     82  Scheduler_priority_SMP_Node *node =
     83    _Scheduler_priority_SMP_Node_get( thread );
     84
     85  _Scheduler_priority_Ready_queue_update(
     86    thread,
     87    &node->Ready_queue,
    6688    &self->Bit_map,
    6789    &self->Ready[ 0 ]
     
    94116  Scheduler_priority_SMP_Context *self =
    95117    _Scheduler_priority_SMP_Self_from_SMP_base( smp_base );
     118  Scheduler_priority_SMP_Node *node =
     119    _Scheduler_priority_SMP_Node_get( scheduled_to_ready );
    96120
    97121  _Chain_Extract_unprotected( &scheduled_to_ready->Object.Node );
    98122  _Scheduler_priority_Ready_queue_enqueue_first(
    99123    scheduled_to_ready,
     124    &node->Ready_queue,
    100125    &self->Bit_map
    101126  );
     
    109134  Scheduler_priority_SMP_Context *self =
    110135    _Scheduler_priority_SMP_Self_from_SMP_base( smp_base );
     136  Scheduler_priority_SMP_Node *node =
     137    _Scheduler_priority_SMP_Node_get( ready_to_scheduled );
    111138
    112139  _Scheduler_priority_Ready_queue_extract(
    113140    ready_to_scheduled,
     141    &node->Ready_queue,
    114142    &self->Bit_map
    115143  );
     
    127155  Scheduler_priority_SMP_Context *self =
    128156    _Scheduler_priority_SMP_Self_from_SMP_base( smp_base );
    129 
    130   _Scheduler_priority_Ready_queue_enqueue( thread, &self->Bit_map );
     157  Scheduler_priority_SMP_Node *node =
     158    _Scheduler_priority_SMP_Node_get( thread );
     159
     160  _Scheduler_priority_Ready_queue_enqueue(
     161    thread,
     162    &node->Ready_queue,
     163    &self->Bit_map
     164  );
    131165}
    132166
     
    138172  Scheduler_priority_SMP_Context *self =
    139173    _Scheduler_priority_SMP_Self_from_SMP_base( smp_base );
    140 
    141   _Scheduler_priority_Ready_queue_enqueue_first( thread, &self->Bit_map );
     174  Scheduler_priority_SMP_Node *node =
     175    _Scheduler_priority_SMP_Node_get( thread );
     176
     177  _Scheduler_priority_Ready_queue_enqueue_first(
     178    thread,
     179    &node->Ready_queue,
     180    &self->Bit_map
     181  );
    142182}
    143183
     
    149189  Scheduler_priority_SMP_Context *self =
    150190    _Scheduler_priority_SMP_Self_from_SMP_base( smp_base );
    151   bool is_scheduled = thread->is_scheduled;
    152 
    153   thread->is_in_the_air = is_scheduled;
    154   thread->is_scheduled = false;
    155 
    156   if ( is_scheduled ) {
     191  Scheduler_priority_SMP_Node *node =
     192    _Scheduler_priority_SMP_Node_get( thread );
     193
     194  if ( node->Base.state == SCHEDULER_SMP_NODE_SCHEDULED ) {
     195    _Scheduler_SMP_Node_change_state(
     196      &node->Base,
     197      SCHEDULER_SMP_NODE_IN_THE_AIR
     198    );
    157199    _Chain_Extract_unprotected( &thread->Object.Node );
    158200  } else {
    159     _Scheduler_priority_Ready_queue_extract( thread, &self->Bit_map );
     201    _Scheduler_SMP_Node_change_state(
     202      &node->Base,
     203      SCHEDULER_SMP_NODE_BLOCKED
     204    );
     205    _Scheduler_priority_Ready_queue_extract(
     206      thread,
     207      &node->Ready_queue,
     208      &self->Bit_map
     209    );
    160210  }
    161211}
  • cpukit/score/src/schedulerpriorityunblock.c

    r5b1ff71a rbeab7329  
    3030  Scheduler_priority_Context *context =
    3131    _Scheduler_priority_Get_context( scheduler );
     32  Scheduler_priority_Node *node = _Scheduler_priority_Node_get( the_thread );
    3233
    33   _Scheduler_priority_Ready_queue_enqueue( the_thread, &context->Bit_map );
     34  _Scheduler_priority_Ready_queue_enqueue(
     35    the_thread,
     36    &node->Ready_queue,
     37    &context->Bit_map
     38  );
    3439
    3540  /* TODO: flash critical section? */
  • cpukit/score/src/schedulerpriorityupdate.c

    r5b1ff71a rbeab7329  
    2828  Scheduler_priority_Context *context =
    2929    _Scheduler_priority_Get_context( scheduler );
     30  Scheduler_priority_Node *node = _Scheduler_priority_Node_get( the_thread );
    3031
    31   _Scheduler_priority_Update_body(
     32  _Scheduler_priority_Ready_queue_update(
    3233    the_thread,
     34    &node->Ready_queue,
    3335    &context->Bit_map,
    3436    &context->Ready[ 0 ]
  • cpukit/score/src/schedulerpriorityyield.c

    r5b1ff71a rbeab7329  
    2828)
    2929{
    30   Scheduler_priority_Per_thread *sched_info_of_thread =
    31     _Scheduler_priority_Get_scheduler_info( the_thread );
    32   Chain_Control *ready_chain = sched_info_of_thread->ready_chain;
     30  Scheduler_priority_Node *node = _Scheduler_priority_Node_get( the_thread );
     31  Chain_Control *ready_chain = node->Ready_queue.ready_chain;
    3332  ISR_Level level;
    3433
  • cpukit/score/src/schedulersimplesmp.c

    r5b1ff71a rbeab7329  
    44 * @brief Simple SMP Scheduler Implementation
    55 *
    6  * @ingroup ScoreSchedulerSMP
     6 * @ingroup ScoreSchedulerSMPSimple
    77 */
    88
     
    4545}
    4646
     47bool _Scheduler_simple_smp_Allocate(
     48  const Scheduler_Control *scheduler,
     49  Thread_Control          *the_thread
     50)
     51{
     52  Scheduler_SMP_Node *node = _Scheduler_SMP_Node_get( the_thread );
     53
     54  _Scheduler_SMP_Node_initialize( node );
     55
     56  return true;
     57}
     58
    4759static Thread_Control *_Scheduler_simple_smp_Get_highest_ready(
    4860  Scheduler_SMP_Context *smp_base
     
    123135)
    124136{
     137  Scheduler_SMP_Node *node = _Scheduler_SMP_Node_get( thread );
     138
    125139  (void) smp_base;
    126140
    127   thread->is_in_the_air = thread->is_scheduled;
    128   thread->is_scheduled = false;
     141  if ( node->state == SCHEDULER_SMP_NODE_SCHEDULED ) {
     142    _Scheduler_SMP_Node_change_state( node, SCHEDULER_SMP_NODE_IN_THE_AIR );
     143  } else {
     144    _Scheduler_SMP_Node_change_state( node, SCHEDULER_SMP_NODE_BLOCKED );
     145  }
    129146
    130147  _Chain_Extract_unprotected( &thread->Object.Node );
  • cpukit/score/src/threadinitialize.c

    r5b1ff71a rbeab7329  
    182182
    183183#if defined(RTEMS_SMP)
    184   the_thread->is_scheduled            = false;
    185   the_thread->is_in_the_air           = false;
    186184  the_thread->scheduler               = scheduler;
    187185  _CPU_Context_Set_is_executing( &the_thread->Registers, false );
  • testsuites/sptests/spsize/size.c

    r5b1ff71a rbeab7329  
    8888 * included in the PER_TASK consumption.
    8989 */
    90 #define SCHEDULER_TASK_WKSP     (sizeof(Scheduler_priority_Per_thread))
     90#define SCHEDULER_TASK_WKSP     (sizeof(Scheduler_priority_Node))
    9191
    9292/* Priority scheduling workspace consumption
Note: See TracChangeset for help on using the changeset viewer.