Changeset beab7329 in rtems
- Timestamp:
- 05/13/14 14:03:05 (10 years ago)
- Branches:
- 4.11, 5, 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)
- Files:
-
- 2 added
- 38 edited
Legend:
- Unmodified
- Added
- Removed
-
cpukit/sapi/include/confdefs.h
r5b1ff71a rbeab7329 2475 2475 #endif 2476 2476 union { 2477 Scheduler_Node Base; 2477 2478 #ifdef CONFIGURE_SCHEDULER_CBS 2478 Scheduler_CBS_ Per_threadCBS;2479 Scheduler_CBS_Node CBS; 2479 2480 #endif 2480 2481 #ifdef CONFIGURE_SCHEDULER_EDF 2481 Scheduler_EDF_ Per_threadEDF;2482 Scheduler_EDF_Node EDF; 2482 2483 #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; 2486 2492 #endif 2487 2493 #ifdef CONFIGURE_SCHEDULER_PRIORITY_AFFINITY_SMP 2488 Scheduler_priority_affinity_SMP_ Per_thread Priority_affinity;2494 Scheduler_priority_affinity_SMP_Node Priority_affinity_SMP; 2489 2495 #endif 2490 2496 #ifdef CONFIGURE_SCHEDULER_USER_PER_THREAD … … 2512 2518 const Thread_Control_add_on _Thread_Control_add_ons[] = { 2513 2519 { 2514 offsetof( Configuration_Thread_control, Control.scheduler_ info),2520 offsetof( Configuration_Thread_control, Control.scheduler_node ), 2515 2521 offsetof( Configuration_Thread_control, Scheduler ) 2516 2522 }, { -
cpukit/score/Makefile.am
r5b1ff71a rbeab7329 53 53 include_rtems_score_HEADERS += include/rtems/score/schedulerimpl.h 54 54 include_rtems_score_HEADERS += include/rtems/score/schedulercbs.h 55 include_rtems_score_HEADERS += include/rtems/score/schedulercbsimpl.h 55 56 include_rtems_score_HEADERS += include/rtems/score/scheduleredf.h 56 57 include_rtems_score_HEADERS += include/rtems/score/scheduleredfimpl.h … … 127 128 if HAS_SMP 128 129 libscore_a_SOURCES += src/profilingsmplock.c 130 libscore_a_SOURCES += src/schedulersmpvalidstatechanges.c 129 131 libscore_a_SOURCES += src/schedulerpriorityaffinitysmp.c 130 132 libscore_a_SOURCES += src/schedulerprioritysmp.c -
cpukit/score/include/rtems/score/scheduler.h
r5b1ff71a rbeab7329 42 42 43 43 typedef struct Scheduler_Control Scheduler_Control; 44 45 typedef struct Scheduler_Node Scheduler_Node; 44 46 45 47 /** … … 155 157 */ 156 158 uint32_t name; 159 }; 160 161 /** 162 * @brief Scheduler node for per-thread data. 163 */ 164 struct Scheduler_Node { 165 /* No fields yet */ 157 166 }; 158 167 -
cpukit/score/include/rtems/score/schedulercbs.h
r5b1ff71a rbeab7329 130 130 typedef struct { 131 131 /** EDF scheduler specific data of a task. */ 132 Scheduler_EDF_ Per_thread edf_per_thread;132 Scheduler_EDF_Node Base; 133 133 /** CBS server specific data of a task. */ 134 134 Scheduler_CBS_Server *cbs_server; 135 } Scheduler_CBS_ Per_thread;135 } Scheduler_CBS_Node; 136 136 137 137 -
cpukit/score/include/rtems/score/scheduleredf.h
r5b1ff71a rbeab7329 92 92 93 93 /** 94 * This structure handles EDF specific data of a thread.94 * @brief Scheduler node specialization for EDF schedulers. 95 95 */ 96 96 typedef struct { 97 97 /** 98 * @brief Basic scheduler node. 99 */ 100 Scheduler_Node Base; 101 102 /** 98 103 * Pointer to corresponding Thread Control Block. 99 104 */ … … 107 112 */ 108 113 Scheduler_EDF_Queue_state queue_state; 109 } Scheduler_EDF_ Per_thread;114 } Scheduler_EDF_Node; 110 115 111 116 /** -
cpukit/score/include/rtems/score/scheduleredfimpl.h
r5b1ff71a rbeab7329 38 38 } 39 39 40 RTEMS_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 40 47 RTEMS_INLINE_ROUTINE void _Scheduler_EDF_Schedule_body( 41 48 const Scheduler_Control *scheduler, … … 47 54 _Scheduler_EDF_Get_context( scheduler ); 48 55 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; 52 59 53 60 ( void ) the_thread; -
cpukit/score/include/rtems/score/schedulerimpl.h
r5b1ff71a rbeab7329 624 624 } 625 625 626 RTEMS_INLINE_ROUTINE Scheduler_Node *_Scheduler_Node_get( 627 Thread_Control *the_thread 628 ) 629 { 630 return the_thread->scheduler_node; 631 } 632 626 633 /** @} */ 627 634 -
cpukit/score/include/rtems/score/schedulerpriority.h
r5b1ff71a rbeab7329 84 84 85 85 /** 86 * Per-thread data related to the _Scheduler_PRIORITY scheduling policy.86 * @brief Data for ready queue operations. 87 87 */ 88 88 typedef struct { … … 92 92 /** This field contains precalculated priority map indices. */ 93 93 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 */ 99 typedef 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; 95 110 96 111 /** -
cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h
r5b1ff71a rbeab7329 119 119 120 120 /** 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. 127 123 */ 128 124 typedef struct { 129 130 125 /** 131 * Data for the Priority Scheduler.126 * @brief SMP priority scheduler node. 132 127 */ 133 Scheduler_priority_ Per_thread Priority_sched_info;128 Scheduler_priority_SMP_Node Base; 134 129 135 130 /** … … 137 132 */ 138 133 CPU_set_Control Affinity; 139 } Scheduler_priority_affinity_SMP_ Per_thread;134 } Scheduler_priority_affinity_SMP_Node; 140 135 141 136 /** @} */ -
cpukit/score/include/rtems/score/schedulerpriorityimpl.h
r5b1ff71a rbeab7329 42 42 } 43 43 44 RTEMS_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 44 51 /** 45 52 * @brief Ready queue initialization. … … 58 65 } 59 66 60 RTEMS_INLINE_ROUTINE Scheduler_priority_ Per_thread*67 RTEMS_INLINE_ROUTINE Scheduler_priority_Node * 61 68 _Scheduler_priority_Get_scheduler_info( Thread_Control *thread ) 62 69 { 63 return ( Scheduler_priority_ Per_thread * ) thread->scheduler_info;64 } 65 66 /** 67 * @brief Put a thread to theready queue.68 * 69 * Th is 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. 70 77 * 71 78 * @param[in] the_thread The thread to enqueue. 79 * @param[in] ready_queue The ready queue. 72 80 * @param[in] bit_map The priority bit map of the scheduler instance. 73 81 */ 74 82 RTEMS_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; 82 89 83 90 _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. 95 101 * @param[in] bit_map The priority bit map of the scheduler instance. 96 102 */ 97 103 RTEMS_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; 105 110 106 111 _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. 115 117 * 116 118 * @param[in] the_thread The thread to extract. 119 * @param[in] ready_queue The ready queue. 117 120 * @param[in] bit_map The priority bit map of the scheduler instance. 118 121 */ 119 122 RTEMS_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; 127 129 128 130 if ( _Chain_Has_only_one_node( ready_chain ) ) { 129 131 _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 ); 131 133 } else { 132 134 _Chain_Extract_unprotected( &the_thread->Object.Node ); … … 141 143 Scheduler_priority_Context *context = 142 144 _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 ); 145 152 } 146 153 … … 166 173 167 174 /** 168 * @brief Requeue a thread on theready queue.175 * @brief Requeues a thread on the specified ready queue. 169 176 * 170 177 * This routine is invoked when a thread changes priority and should be 171 178 * moved to a different position on the ready queue. 172 179 * 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. 174 182 */ 175 183 RTEMS_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; 182 189 183 190 if ( !_Chain_Has_only_one_node( ready_chain ) ) { … … 211 218 } 212 219 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 */ 229 RTEMS_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 ]; 224 238 225 239 _Priority_bit_map_Initialize_information( 226 240 bit_map, 227 & sched_info_of_thread->Priority_map,228 thread->current_priority241 &ready_queue->Priority_map, 242 priority 229 243 ); 230 244 } -
cpukit/score/include/rtems/score/schedulerprioritysmp.h
r5b1ff71a rbeab7329 48 48 */ 49 49 50 /** 51 * @brief Scheduler context specialization for Deterministic Priority SMP 52 * schedulers. 53 */ 50 54 typedef struct { 51 55 Scheduler_SMP_Context Base; 52 56 Priority_bit_map_Control Bit_map; 53 Chain_Control Ready[ 0];57 Chain_Control Ready[ RTEMS_ZERO_LENGTH_ARRAY ]; 54 58 } Scheduler_priority_SMP_Context; 59 60 /** 61 * @brief Scheduler node specialization for Deterministic Priority SMP 62 * schedulers. 63 */ 64 typedef 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; 55 75 56 76 /** … … 64 84 _Scheduler_priority_SMP_Block, \ 65 85 _Scheduler_priority_SMP_Enqueue_fifo, \ 66 _Scheduler_ default_Allocate, \86 _Scheduler_priority_SMP_Allocate, \ 67 87 _Scheduler_default_Free, \ 68 88 _Scheduler_priority_SMP_Update, \ … … 79 99 80 100 void _Scheduler_priority_SMP_Initialize( const Scheduler_Control *scheduler ); 101 102 bool _Scheduler_priority_SMP_Allocate( 103 const Scheduler_Control *scheduler, 104 Thread_Control *thread 105 ); 81 106 82 107 void _Scheduler_priority_SMP_Schedule( -
cpukit/score/include/rtems/score/schedulersimplesmp.h
r5b1ff71a rbeab7329 65 65 _Scheduler_simple_smp_Block, \ 66 66 _Scheduler_simple_smp_Enqueue_priority_fifo, \ 67 _Scheduler_ default_Allocate, \67 _Scheduler_simple_smp_Allocate, \ 68 68 _Scheduler_default_Free, \ 69 69 _Scheduler_default_Update, \ … … 80 80 81 81 void _Scheduler_simple_smp_Initialize( const Scheduler_Control *scheduler ); 82 83 bool _Scheduler_simple_smp_Allocate( 84 const Scheduler_Control *scheduler, 85 Thread_Control *the_thread 86 ); 82 87 83 88 void _Scheduler_simple_smp_Block( -
cpukit/score/include/rtems/score/schedulersmp.h
r5b1ff71a rbeab7329 39 39 */ 40 40 41 /** 42 * @brief Scheduler context specialization for SMP schedulers. 43 */ 41 44 typedef struct { 42 45 /** … … 45 48 Scheduler_Context Base; 46 49 50 /** 51 * @brief The chain of scheduled nodes. 52 */ 47 53 Chain_Control Scheduled; 48 54 } Scheduler_SMP_Context; 55 56 /** 57 * @brief SMP scheduler node states. 58 */ 59 typedef 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 */ 104 typedef 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; 49 115 50 116 /** @} */ -
cpukit/score/include/rtems/score/schedulersmpimpl.h
r5b1ff71a rbeab7329 63 63 { 64 64 _Chain_Initialize_empty( &self->Scheduled ); 65 } 66 67 static 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 74 static inline void _Scheduler_SMP_Node_initialize( 75 Scheduler_SMP_Node *node 76 ) 77 { 78 node->state = SCHEDULER_SMP_NODE_BLOCKED; 79 } 80 81 extern const bool _Scheduler_SMP_Node_valid_state_changes[ 4 ][ 4 ]; 82 83 static 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; 65 93 } 66 94 … … 107 135 ) 108 136 { 137 Scheduler_SMP_Node *scheduled_node = _Scheduler_SMP_Node_get( scheduled ); 109 138 Per_CPU_Control *cpu_of_scheduled = _Thread_Get_CPU( scheduled ); 110 139 Per_CPU_Control *cpu_of_victim = _Thread_Get_CPU( victim ); … … 112 141 Thread_Control *heir; 113 142 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 ); 116 147 117 148 _Assert( _ISR_Get_level() != 0 ); … … 161 192 ) 162 193 { 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 ) { 164 197 Thread_Control *highest_ready = ( *get_highest_ready )( self ); 165 166 thread->is_in_the_air = false;167 198 168 199 /* … … 176 207 && !( *order )( &thread->Object.Node, &highest_ready->Object.Node ) 177 208 ) { 209 _Scheduler_SMP_Node_change_state( node, SCHEDULER_SMP_NODE_READY ); 178 210 _Scheduler_SMP_Allocate_processor( self, highest_ready, thread ); 179 180 211 ( *insert_ready )( self, thread ); 181 212 ( *move_from_ready_to_scheduled )( self, highest_ready ); 182 213 } else { 183 thread->is_scheduled = true; 184 214 _Scheduler_SMP_Node_change_state( node, SCHEDULER_SMP_NODE_SCHEDULED ); 185 215 ( *insert_scheduled )( self, thread ); 186 216 } … … 196 226 && ( *order )( &thread->Object.Node, &lowest_scheduled->Object.Node ) 197 227 ) { 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 ); 198 235 _Scheduler_SMP_Allocate_processor( self, thread, lowest_scheduled ); 199 200 236 ( *insert_scheduled )( self, thread ); 201 237 ( *move_from_scheduled_to_ready )( self, lowest_scheduled ); 202 238 } else { 239 _Scheduler_SMP_Node_change_state( node, SCHEDULER_SMP_NODE_READY ); 203 240 ( *insert_ready )( self, thread ); 204 241 } … … 227 264 ) 228 265 { 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 ); 231 270 232 271 _Scheduler_SMP_Schedule_highest_ready( … … 296 335 ) 297 336 { 298 thread->is_scheduled = true; 337 Scheduler_SMP_Node *node = _Scheduler_SMP_Node_get( thread ); 338 339 node->state = SCHEDULER_SMP_NODE_SCHEDULED; 340 299 341 _Thread_Set_CPU( thread, cpu ); 300 342 _Chain_Append_unprotected( &self->Scheduled, &thread->Object.Node ); -
cpukit/score/include/rtems/score/thread.h
r5b1ff71a rbeab7329 39 39 40 40 struct Scheduler_Control; 41 42 struct Scheduler_Node; 41 43 42 44 #ifdef __cplusplus … … 480 482 #if defined(RTEMS_SMP) 481 483 /** 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 a485 * processor for it. A scheduled thread is assigned to exactly one486 * processor. There are exactly processor count scheduled threads in the487 * 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 an495 * executing or heir thread on exactly one processor) and it is not a member496 * of the scheduled chain. The extract operation on a scheduled thread will497 * produce threads in the air (see also _Thread_Set_transient()). The next498 * enqueue or schedule operation will decide what to do based on this state499 * indication. It can either place the thread back on the scheduled chain500 * and the thread can keep its allocated processor, or it can take the501 * processor away from the thread and give the processor to another thread of502 * higher priority.503 */504 bool is_in_the_air;505 506 /**507 484 * @brief The scheduler of this thread. 508 485 */ … … 531 508 Thread_CPU_usage_t cpu_time_used; 532 509 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; 535 514 536 515 #ifdef RTEMS_SMP -
cpukit/score/preinstall.am
r5b1ff71a rbeab7329 191 191 $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/schedulercbs.h 192 192 PREINSTALL_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 196 PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/schedulercbsimpl.h 193 197 194 198 $(PROJECT_INCLUDE)/rtems/score/scheduleredf.h: include/rtems/score/scheduleredf.h $(PROJECT_INCLUDE)/rtems/score/$(dirstamp) -
cpukit/score/src/schedulercbs.c
r5b1ff71a rbeab7329 19 19 #endif 20 20 21 #include <rtems/score/schedulercbs .h>21 #include <rtems/score/schedulercbsimpl.h> 22 22 #include <rtems/score/threadimpl.h> 23 23 #include <rtems/score/wkspace.h> … … 28 28 { 29 29 Priority_Control new_priority; 30 Scheduler_CBS_ Per_thread *sched_info;30 Scheduler_CBS_Node *node; 31 31 Scheduler_CBS_Server_id server_id; 32 32 … … 39 39 40 40 /* 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 ) { 43 43 _Scheduler_CBS_Get_server_id( 44 sched_info->cbs_server->task_id,44 node->cbs_server->task_id, 45 45 &server_id 46 46 ); 47 sched_info->cbs_server->cbs_budget_overrun( server_id );47 node->cbs_server->cbs_budget_overrun( server_id ); 48 48 } 49 49 } -
cpukit/score/src/schedulercbsallocate.c
r5b1ff71a rbeab7329 19 19 #endif 20 20 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> 27 22 28 23 bool _Scheduler_CBS_Allocate( … … 31 26 ) 32 27 { 33 Scheduler_CBS_ Per_thread *schinfo = the_thread->scheduler_info;28 Scheduler_CBS_Node *node = _Scheduler_CBS_Node_get( the_thread ); 34 29 35 30 (void) scheduler; 36 31 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; 40 35 41 36 return true; -
cpukit/score/src/schedulercbsattachthread.c
r5b1ff71a rbeab7329 19 19 #endif 20 20 21 #include <rtems/score/schedulercbs .h>21 #include <rtems/score/schedulercbsimpl.h> 22 22 #include <rtems/score/threadimpl.h> 23 23 … … 44 44 /* The routine _Thread_Get may disable dispatch and not enable again. */ 45 45 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 ); 49 47 50 48 /* Thread is already attached to a server. */ 51 if ( sched_info->cbs_server ) {49 if ( node->cbs_server ) { 52 50 _Objects_Put( &the_thread->Object ); 53 51 return SCHEDULER_CBS_ERROR_FULL; … … 55 53 56 54 _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]; 58 56 59 57 the_thread->budget_callout = _Scheduler_CBS_Budget_callout; -
cpukit/score/src/schedulercbsdetachthread.c
r5b1ff71a rbeab7329 20 20 #endif 21 21 22 #include <rtems/score/schedulercbs .h>22 #include <rtems/score/schedulercbsimpl.h> 23 23 #include <rtems/score/threadimpl.h> 24 24 … … 30 30 Objects_Locations location; 31 31 Thread_Control *the_thread; 32 Scheduler_CBS_Per_thread *sched_info;33 32 34 33 if ( server_id >= _Scheduler_CBS_Maximum_servers ) … … 44 43 /* The routine _Thread_Get may disable dispatch and not enable again. */ 45 44 if ( the_thread ) { 45 Scheduler_CBS_Node *node = _Scheduler_CBS_Node_get( the_thread ); 46 46 47 _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; 49 49 50 50 the_thread->budget_algorithm = the_thread->Start.budget_algorithm; -
cpukit/score/src/schedulercbsreleasejob.c
r5b1ff71a rbeab7329 20 20 #endif 21 21 22 #include <rtems/score/schedulercbs .h>22 #include <rtems/score/schedulercbsimpl.h> 23 23 #include <rtems/score/threadimpl.h> 24 24 #include <rtems/score/watchdogimpl.h> … … 30 30 ) 31 31 { 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; 37 35 38 36 if (deadline) { -
cpukit/score/src/schedulercbsunblock.c
r5b1ff71a rbeab7329 20 20 #endif 21 21 22 #include <rtems/score/schedulercbs .h>22 #include <rtems/score/schedulercbsimpl.h> 23 23 #include <rtems/score/schedulerimpl.h> 24 24 #include <rtems/score/threadimpl.h> … … 30 30 ) 31 31 { 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; 35 35 36 36 _Scheduler_EDF_Enqueue( scheduler, the_thread ); 37 37 /* 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;41 38 42 39 /* -
cpukit/score/src/scheduleredf.c
r5b1ff71a rbeab7329 28 28 { 29 29 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; 31 31 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; 33 33 34 34 /* -
cpukit/score/src/scheduleredfallocate.c
r5b1ff71a rbeab7329 19 19 #endif 20 20 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> 26 22 27 23 bool _Scheduler_EDF_Allocate( … … 30 26 ) 31 27 { 32 Scheduler_EDF_ Per_thread *schinfo = the_thread->scheduler_info;28 Scheduler_EDF_Node *node = _Scheduler_EDF_Node_get( the_thread ); 33 29 34 30 (void) scheduler; 35 31 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; 39 34 40 35 return true; -
cpukit/score/src/scheduleredfenqueue.c
r5b1ff71a rbeab7329 28 28 Scheduler_EDF_Context *context = 29 29 _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 ); 33 31 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; 36 34 } -
cpukit/score/src/scheduleredfextract.c
r5b1ff71a rbeab7329 28 28 Scheduler_EDF_Context *context = 29 29 _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 ); 33 31 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; 36 34 } -
cpukit/score/src/scheduleredfupdate.c
r5b1ff71a rbeab7329 19 19 #endif 20 20 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> 27 22 28 23 void _Scheduler_EDF_Update( … … 31 26 ) 32 27 { 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 ); 35 29 36 30 (void) scheduler; 37 31 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) { 39 33 /* Shifts the priority to the region of background tasks. */ 40 34 the_thread->Start.initial_priority |= (SCHEDULER_EDF_PRIO_MSB); 41 35 the_thread->real_priority = the_thread->Start.initial_priority; 42 36 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; 44 38 } 45 39 } -
cpukit/score/src/scheduleredfyield.c
r5b1ff71a rbeab7329 29 29 Scheduler_EDF_Context *context = 30 30 _Scheduler_EDF_Get_context( scheduler ); 31 Scheduler_EDF_Node *node = _Scheduler_EDF_Node_get( the_thread ); 31 32 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);36 33 37 34 _ISR_Disable( level ); … … 41 38 * with the same priority in case there are such ones. 42 39 */ 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 ); 45 42 46 43 _ISR_Flash( level ); -
cpukit/score/src/schedulerpriorityaffinitysmp.c
r5b1ff71a rbeab7329 26 26 #include <rtems/score/cpusetimpl.h> 27 27 28 RTEMS_INLINE_ROUTINE Scheduler_priority_affinity_SMP_Per_thread*29 _Scheduler_priority_affinity_ Get_scheduler_info( Thread_Control *thread )28 static Scheduler_priority_affinity_SMP_Node * 29 _Scheduler_priority_affinity_Node_get( Thread_Control *thread ) 30 30 { 31 return ( Scheduler_priority_affinity_SMP_Per_thread * ) thread->scheduler_info; 31 return ( Scheduler_priority_affinity_SMP_Node * ) 32 _Scheduler_Node_get( thread ); 32 33 } 33 34 … … 37 38 ) 38 39 { 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 ); 41 42 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; 44 47 45 48 return true; … … 53 56 ) 54 57 { 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); 57 60 58 61 (void) scheduler; 59 62 60 if ( info->Affinity.setsize != cpusetsize ) {63 if ( node->Affinity.setsize != cpusetsize ) { 61 64 return false; 62 65 } 63 66 64 CPU_COPY( cpuset, info->Affinity.set );67 CPU_COPY( cpuset, node->Affinity.set ); 65 68 return true; 66 69 } … … 73 76 ) 74 77 { 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); 77 80 78 81 (void) scheduler; … … 82 85 } 83 86 84 CPU_COPY( info->Affinity.set, cpuset );87 CPU_COPY( node->Affinity.set, cpuset ); 85 88 86 89 return true; -
cpukit/score/src/schedulerpriorityenqueue.c
r5b1ff71a rbeab7329 28 28 Scheduler_priority_Context *context = 29 29 _Scheduler_priority_Get_context( scheduler ); 30 Scheduler_priority_Node *node = _Scheduler_priority_Node_get( the_thread ); 30 31 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 ); 32 37 } -
cpukit/score/src/schedulerpriorityenqueuefirst.c
r5b1ff71a rbeab7329 28 28 Scheduler_priority_Context *context = 29 29 _Scheduler_priority_Get_context( scheduler ); 30 Scheduler_priority_Node *node = _Scheduler_priority_Node_get( the_thread ); 30 31 31 32 _Scheduler_priority_Ready_queue_enqueue_first( 32 33 the_thread, 34 &node->Ready_queue, 33 35 &context->Bit_map 34 36 ); -
cpukit/score/src/schedulerprioritysmp.c
r5b1ff71a rbeab7329 2 2 * @file 3 3 * 4 * @ingroup ScoreSchedulerPrioritySMP 5 * 4 6 * @brief Deterministic Priority SMP Scheduler Implementation 5 *6 * @ingroup ScoreSchedulerSMP7 7 */ 8 8 … … 44 44 } 45 45 46 static 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 46 53 void _Scheduler_priority_SMP_Initialize( const Scheduler_Control *scheduler ) 47 54 { … … 54 61 } 55 62 63 bool _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 56 75 void _Scheduler_priority_SMP_Update( 57 76 const Scheduler_Control *scheduler, … … 61 80 Scheduler_priority_SMP_Context *self = 62 81 _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, 66 88 &self->Bit_map, 67 89 &self->Ready[ 0 ] … … 94 116 Scheduler_priority_SMP_Context *self = 95 117 _Scheduler_priority_SMP_Self_from_SMP_base( smp_base ); 118 Scheduler_priority_SMP_Node *node = 119 _Scheduler_priority_SMP_Node_get( scheduled_to_ready ); 96 120 97 121 _Chain_Extract_unprotected( &scheduled_to_ready->Object.Node ); 98 122 _Scheduler_priority_Ready_queue_enqueue_first( 99 123 scheduled_to_ready, 124 &node->Ready_queue, 100 125 &self->Bit_map 101 126 ); … … 109 134 Scheduler_priority_SMP_Context *self = 110 135 _Scheduler_priority_SMP_Self_from_SMP_base( smp_base ); 136 Scheduler_priority_SMP_Node *node = 137 _Scheduler_priority_SMP_Node_get( ready_to_scheduled ); 111 138 112 139 _Scheduler_priority_Ready_queue_extract( 113 140 ready_to_scheduled, 141 &node->Ready_queue, 114 142 &self->Bit_map 115 143 ); … … 127 155 Scheduler_priority_SMP_Context *self = 128 156 _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 ); 131 165 } 132 166 … … 138 172 Scheduler_priority_SMP_Context *self = 139 173 _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 ); 142 182 } 143 183 … … 149 189 Scheduler_priority_SMP_Context *self = 150 190 _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 ); 157 199 _Chain_Extract_unprotected( &thread->Object.Node ); 158 200 } 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 ); 160 210 } 161 211 } -
cpukit/score/src/schedulerpriorityunblock.c
r5b1ff71a rbeab7329 30 30 Scheduler_priority_Context *context = 31 31 _Scheduler_priority_Get_context( scheduler ); 32 Scheduler_priority_Node *node = _Scheduler_priority_Node_get( the_thread ); 32 33 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 ); 34 39 35 40 /* TODO: flash critical section? */ -
cpukit/score/src/schedulerpriorityupdate.c
r5b1ff71a rbeab7329 28 28 Scheduler_priority_Context *context = 29 29 _Scheduler_priority_Get_context( scheduler ); 30 Scheduler_priority_Node *node = _Scheduler_priority_Node_get( the_thread ); 30 31 31 _Scheduler_priority_ Update_body(32 _Scheduler_priority_Ready_queue_update( 32 33 the_thread, 34 &node->Ready_queue, 33 35 &context->Bit_map, 34 36 &context->Ready[ 0 ] -
cpukit/score/src/schedulerpriorityyield.c
r5b1ff71a rbeab7329 28 28 ) 29 29 { 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; 33 32 ISR_Level level; 34 33 -
cpukit/score/src/schedulersimplesmp.c
r5b1ff71a rbeab7329 4 4 * @brief Simple SMP Scheduler Implementation 5 5 * 6 * @ingroup ScoreSchedulerSMP 6 * @ingroup ScoreSchedulerSMPSimple 7 7 */ 8 8 … … 45 45 } 46 46 47 bool _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 47 59 static Thread_Control *_Scheduler_simple_smp_Get_highest_ready( 48 60 Scheduler_SMP_Context *smp_base … … 123 135 ) 124 136 { 137 Scheduler_SMP_Node *node = _Scheduler_SMP_Node_get( thread ); 138 125 139 (void) smp_base; 126 140 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 } 129 146 130 147 _Chain_Extract_unprotected( &thread->Object.Node ); -
cpukit/score/src/threadinitialize.c
r5b1ff71a rbeab7329 182 182 183 183 #if defined(RTEMS_SMP) 184 the_thread->is_scheduled = false;185 the_thread->is_in_the_air = false;186 184 the_thread->scheduler = scheduler; 187 185 _CPU_Context_Set_is_executing( &the_thread->Registers, false ); -
testsuites/sptests/spsize/size.c
r5b1ff71a rbeab7329 88 88 * included in the PER_TASK consumption. 89 89 */ 90 #define SCHEDULER_TASK_WKSP (sizeof(Scheduler_priority_ Per_thread))90 #define SCHEDULER_TASK_WKSP (sizeof(Scheduler_priority_Node)) 91 91 92 92 /* Priority scheduling workspace consumption
Note: See TracChangeset
for help on using the changeset viewer.