RTEMS  5.1
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 
105  Scheduler_EDF_SMP_Ready_queue Ready[ RTEMS_ZERO_LENGTH_ARRAY ];
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.
Definition: scheduleredfsmp.h:55
Scheduler context specialization for SMP schedulers.
Definition: schedulersmp.h:46
uint8_t pinning_ready_queue_index
Ready queue index according to thread pinning.
Definition: scheduleredfsmp.h:65
Definition: chain.h:68
Chain_Control Affine_queues
Chain of ready queues with affine threads to determine the highest priority ready thread.
Definition: scheduleredfsmp.h:97
Definition: scheduleredfsmp.h:85
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.
Definition: scheduleredfsmp.c:61
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.
Definition: scheduleredfsmp.c:719
Definition: chain.h:86
void _Scheduler_EDF_SMP_Unblock(const Scheduler_Control *scheduler, Thread_Control *thread, Scheduler_Node *node)
Unblocks the thread.
Definition: scheduleredfsmp.c:476
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.
Definition: scheduleredfsmp.c:512
void _Scheduler_EDF_SMP_Pin(const Scheduler_Control *scheduler, Thread_Control *the_thread, Scheduler_Node *node, struct Per_CPU_Control *cpu)
Pin thread operation.
Definition: scheduleredfsmp.c:675
Definition: scheduleredfsmp.h:38
Definition: thread.h:732
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.
Definition: scheduleredfsmp.c:417
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.
Definition: scheduleredfsmp.c:625
Definition: scheduleredfsmp.h:68
int64_t generation
Generation number to ensure FIFO/LIFO order for threads of the same priority across different ready q...
Definition: scheduleredfsmp.h:45
Scheduler_EDF_SMP_Node * scheduled
The scheduled thread of the corresponding processor.
Definition: scheduleredfsmp.h:82
RBTree_Control Queue
The ready threads of the corresponding affinity.
Definition: scheduleredfsmp.h:77
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.
Definition: scheduleredfsmp.c:559
void _Scheduler_EDF_SMP_Add_processor(const Scheduler_Control *scheduler, Thread_Control *idle)
Adds processor.
Definition: scheduleredfsmp.c:594
Scheduler control.
Definition: scheduler.h:269
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.
Definition: scheduleredfsmp.c:698
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.
Definition: scheduleredfsmp.c:71
Chain_Node Node
Chain node for Scheduler_SMP_Context::Affine_queues.
Definition: scheduleredfsmp.h:72
Thread_Control * _Scheduler_EDF_SMP_Remove_processor(const Scheduler_Control *scheduler, struct Per_CPU_Control *cpu)
Removes an idle thread from the given cpu.
Definition: scheduleredfsmp.c:610
void _Scheduler_EDF_SMP_Reconsider_help_request(const Scheduler_Control *scheduler, Thread_Control *the_thread, Scheduler_Node *node)
Reconsiders help operation.
Definition: scheduleredfsmp.c:543
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.
Definition: scheduleredfsmp.c:657
uint8_t affinity_ready_queue_index
Ready queue index according to thread affinity.
Definition: scheduleredfsmp.h:60
bool _Scheduler_EDF_SMP_Ask_for_help(const Scheduler_Control *scheduler, Thread_Control *the_thread, Scheduler_Node *node)
Asks for help operation.
Definition: scheduleredfsmp.c:532