RTEMS
scheduleredfsmp.h
Go to the documentation of this file.
1 
9 /*
10  * Copyright (c) 2017, 2018 embedded brains GmbH.
11  *
12  * The license and distribution terms for this file may be
13  * found in the file LICENSE in this distribution or at
14  * http://www.rtems.org/license/LICENSE.
15  */
16 
17 #ifndef _RTEMS_SCORE_SCHEDULEREDFSMP_H
18 #define _RTEMS_SCORE_SCHEDULEREDFSMP_H
19 
20 #include <rtems/score/scheduler.h>
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
38 typedef struct {
39  Scheduler_SMP_Node Base;
40 
45  int64_t generation;
46 
56 
61 
67 
68 typedef struct {
73 
77  RBTree_Control Queue;
78 
84 
85 typedef struct {
87 
91  int64_t generations[ 2 ];
92 
98 
107 
108 #define SCHEDULER_EDF_SMP_ENTRY_POINTS \
109  { \
110  _Scheduler_EDF_SMP_Initialize, \
111  _Scheduler_default_Schedule, \
112  _Scheduler_EDF_SMP_Yield, \
113  _Scheduler_EDF_SMP_Block, \
114  _Scheduler_EDF_SMP_Unblock, \
115  _Scheduler_EDF_SMP_Update_priority, \
116  _Scheduler_EDF_Map_priority, \
117  _Scheduler_EDF_Unmap_priority, \
118  _Scheduler_EDF_SMP_Ask_for_help, \
119  _Scheduler_EDF_SMP_Reconsider_help_request, \
120  _Scheduler_EDF_SMP_Withdraw_node, \
121  _Scheduler_EDF_SMP_Pin, \
122  _Scheduler_EDF_SMP_Unpin, \
123  _Scheduler_EDF_SMP_Add_processor, \
124  _Scheduler_EDF_SMP_Remove_processor, \
125  _Scheduler_EDF_SMP_Node_initialize, \
126  _Scheduler_default_Node_destroy, \
127  _Scheduler_EDF_Release_job, \
128  _Scheduler_EDF_Cancel_job, \
129  _Scheduler_default_Tick, \
130  _Scheduler_EDF_SMP_Start_idle, \
131  _Scheduler_EDF_SMP_Set_affinity \
132  }
133 
139 void _Scheduler_EDF_SMP_Initialize( const Scheduler_Control *scheduler );
140 
150  const Scheduler_Control *scheduler,
151  Scheduler_Node *node,
152  Thread_Control *the_thread,
153  Priority_Control priority
154 );
155 
164  const Scheduler_Control *scheduler,
165  Thread_Control *thread,
166  Scheduler_Node *node
167 );
168 
177  const Scheduler_Control *scheduler,
178  Thread_Control *thread,
179  Scheduler_Node *node
180 );
181 
190  const Scheduler_Control *scheduler,
191  Thread_Control *the_thread,
192  Scheduler_Node *node
193 );
194 
206  const Scheduler_Control *scheduler,
207  Thread_Control *the_thread,
208  Scheduler_Node *node
209 );
210 
220  const Scheduler_Control *scheduler,
221  Thread_Control *the_thread,
222  Scheduler_Node *node
223 );
224 
235  const Scheduler_Control *scheduler,
236  Thread_Control *the_thread,
237  Scheduler_Node *node,
238  Thread_Scheduler_state next_state
239 );
240 
250  const Scheduler_Control *scheduler,
251  Thread_Control *the_thread,
252  Scheduler_Node *node,
253  struct Per_CPU_Control *cpu
254 );
255 
265  const Scheduler_Control *scheduler,
266  Thread_Control *the_thread,
267  Scheduler_Node *node,
268  struct Per_CPU_Control *cpu
269 );
270 
278  const Scheduler_Control *scheduler,
279  Thread_Control *idle
280 );
281 
291  const Scheduler_Control *scheduler,
292  struct Per_CPU_Control *cpu
293 );
294 
303  const Scheduler_Control *scheduler,
304  Thread_Control *thread,
305  Scheduler_Node *node
306 );
307 
316  const Scheduler_Control *scheduler,
317  Thread_Control *idle,
318  struct Per_CPU_Control *cpu
319 );
320 
335  const Scheduler_Control *scheduler,
336  Thread_Control *thread,
337  Scheduler_Node *node,
338  const Processor_mask *affinity
339 );
340 
343 #ifdef __cplusplus
344 }
345 #endif
346 
347 #endif /* _RTEMS_SCORE_SCHEDULEREDFSMP_H */
uint8_t ready_queue_index
The ready queue index depending on the processor affinity and pinning of the thread.
Scheduler context specialization for SMP schedulers.
Definition: schedulersmp.h:46
uint8_t pinning_ready_queue_index
Ready queue index according to thread pinning.
Chain_Control Affine_queues
Chain of ready queues with affine threads to determine the highest priority ready thread...
SMP Scheduler API.
uint64_t Priority_Control
The thread priority control.
Definition: priority.h:70
void _Scheduler_EDF_SMP_Initialize(const Scheduler_Control *scheduler)
Initializes the context of the scheduler control.
bool _Scheduler_EDF_SMP_Set_affinity(const Scheduler_Control *scheduler, Thread_Control *thread, Scheduler_Node *node, const Processor_mask *affinity)
Checks if the processor set of the scheduler is the subset of the affinity set.
void _Scheduler_EDF_SMP_Unblock(const Scheduler_Control *scheduler, Thread_Control *thread, Scheduler_Node *node)
Unblocks the thread.
Data Related to the Manipulation of Threads for the EDF Scheduler.
void _Scheduler_EDF_SMP_Update_priority(const Scheduler_Control *scheduler, Thread_Control *the_thread, Scheduler_Node *node)
Updates the priority of the node.
void _Scheduler_EDF_SMP_Pin(const Scheduler_Control *scheduler, Thread_Control *the_thread, Scheduler_Node *node, struct Per_CPU_Control *cpu)
Pin thread operation.
#define RTEMS_ZERO_LENGTH_ARRAY
This is a constant to declare zero-length arrays.
Definition: basedefs.h:945
Thread_Scheduler_state
The thread state with respect to the scheduler.
Definition: thread.h:214
Per CPU Core Structure.
Definition: percpu.h:347
void _Scheduler_EDF_SMP_Block(const Scheduler_Control *scheduler, Thread_Control *thread, Scheduler_Node *node)
Blocks the thread.
Scheduler node specialization for SMP schedulers.
Definition: schedulersmp.h:100
void _Scheduler_EDF_SMP_Yield(const Scheduler_Control *scheduler, Thread_Control *thread, Scheduler_Node *node)
Performs the yield of a thread.
int64_t generation
Generation number to ensure FIFO/LIFO order for threads of the same priority across different ready q...
Scheduler_EDF_SMP_Node * scheduled
The scheduled thread of the corresponding processor.
RBTree_Control Queue
The ready threads of the corresponding affinity.
void _Scheduler_EDF_SMP_Withdraw_node(const Scheduler_Control *scheduler, Thread_Control *the_thread, Scheduler_Node *node, Thread_Scheduler_state next_state)
Withdraws node operation.
void _Scheduler_EDF_SMP_Add_processor(const Scheduler_Control *scheduler, Thread_Control *idle)
Adds processor.
Scheduler control.
Definition: scheduler.h:264
Scheduler node for per-thread data.
Definition: schedulernode.h:79
void _Scheduler_EDF_SMP_Unpin(const Scheduler_Control *scheduler, Thread_Control *the_thread, Scheduler_Node *node, struct Per_CPU_Control *cpu)
Unpin thread operation.
void _Scheduler_EDF_SMP_Node_initialize(const Scheduler_Control *scheduler, Scheduler_Node *node, Thread_Control *the_thread, Priority_Control priority)
Initializes the node with the given priority.
Chain_Node Node
Chain node for Scheduler_SMP_Context::Affine_queues.
Thread_Control * _Scheduler_EDF_SMP_Remove_processor(const Scheduler_Control *scheduler, struct Per_CPU_Control *cpu)
Removes an idle thread from the given cpu.
void _Scheduler_EDF_SMP_Reconsider_help_request(const Scheduler_Control *scheduler, Thread_Control *the_thread, Scheduler_Node *node)
Reconsiders help operation.
Constants and Structures Associated with the Scheduler.
void _Scheduler_EDF_SMP_Start_idle(const Scheduler_Control *scheduler, Thread_Control *idle, struct Per_CPU_Control *cpu)
Starts an idle thread.
uint8_t affinity_ready_queue_index
Ready queue index according to thread affinity.
bool _Scheduler_EDF_SMP_Ask_for_help(const Scheduler_Control *scheduler, Thread_Control *the_thread, Scheduler_Node *node)
Asks for help operation.