RTEMS: cpukit/include/rtems/score/scheduleredfsmp.h Source File

| RTEMS 5.4-rc2

Loading...
Searching...
No Matches
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>
21#include <rtems/score/scheduleredf.h>
22#include <rtems/score/schedulersmp.h>
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
38 typedef struct {
39 Scheduler_SMP_Node Base;
40
45 int64_t generation;
46
55 uint8_t ready_queue_index;
56
60 uint8_t affinity_ready_queue_index;
61
65 uint8_t pinning_ready_queue_index;
66} Scheduler_EDF_SMP_Node;
67
68 typedef struct {
72 Chain_Node Node;
73
77 RBTree_Control Queue;
78
82 Scheduler_EDF_SMP_Node *scheduled;
83} Scheduler_EDF_SMP_Ready_queue;
84
85 typedef struct {
86 Scheduler_SMP_Context Base;
87
91 int64_t generations[ 2 ];
92
97 Chain_Control Affine_queues;
98
105 Scheduler_EDF_SMP_Ready_queue Ready[ RTEMS_ZERO_LENGTH_ARRAY ];
106} Scheduler_EDF_SMP_Context;
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
139void _Scheduler_EDF_SMP_Initialize( const Scheduler_Control *scheduler );
140
149void _Scheduler_EDF_SMP_Node_initialize(
150 const Scheduler_Control *scheduler,
151 Scheduler_Node *node,
152 Thread_Control *the_thread,
153 Priority_Control priority
154);
155
163void _Scheduler_EDF_SMP_Block(
164 const Scheduler_Control *scheduler,
165 Thread_Control *thread,
166 Scheduler_Node *node
167);
168
176void _Scheduler_EDF_SMP_Unblock(
177 const Scheduler_Control *scheduler,
178 Thread_Control *thread,
179 Scheduler_Node *node
180);
181
189void _Scheduler_EDF_SMP_Update_priority(
190 const Scheduler_Control *scheduler,
191 Thread_Control *the_thread,
192 Scheduler_Node *node
193);
194
205bool _Scheduler_EDF_SMP_Ask_for_help(
206 const Scheduler_Control *scheduler,
207 Thread_Control *the_thread,
208 Scheduler_Node *node
209);
210
219void _Scheduler_EDF_SMP_Reconsider_help_request(
220 const Scheduler_Control *scheduler,
221 Thread_Control *the_thread,
222 Scheduler_Node *node
223);
224
234void _Scheduler_EDF_SMP_Withdraw_node(
235 const Scheduler_Control *scheduler,
236 Thread_Control *the_thread,
237 Scheduler_Node *node,
238 Thread_Scheduler_state next_state
239);
240
249void _Scheduler_EDF_SMP_Pin(
250 const Scheduler_Control *scheduler,
251 Thread_Control *the_thread,
252 Scheduler_Node *node,
253 struct Per_CPU_Control *cpu
254);
255
264void _Scheduler_EDF_SMP_Unpin(
265 const Scheduler_Control *scheduler,
266 Thread_Control *the_thread,
267 Scheduler_Node *node,
268 struct Per_CPU_Control *cpu
269);
270
277void _Scheduler_EDF_SMP_Add_processor(
278 const Scheduler_Control *scheduler,
279 Thread_Control *idle
280);
281
290 Thread_Control *_Scheduler_EDF_SMP_Remove_processor(
291 const Scheduler_Control *scheduler,
292 struct Per_CPU_Control *cpu
293);
294
302void _Scheduler_EDF_SMP_Yield(
303 const Scheduler_Control *scheduler,
304 Thread_Control *thread,
305 Scheduler_Node *node
306);
307
315void _Scheduler_EDF_SMP_Start_idle(
316 const Scheduler_Control *scheduler,
317 Thread_Control *idle,
318 struct Per_CPU_Control *cpu
319);
320
334bool _Scheduler_EDF_SMP_Set_affinity(
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 */
Priority_Control
uint64_t Priority_Control
The thread priority control.
Definition: priority.h:70
_Scheduler_EDF_SMP_Yield
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
_Scheduler_EDF_SMP_Set_affinity
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
_Scheduler_EDF_SMP_Start_idle
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
_Scheduler_EDF_SMP_Node_initialize
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
_Scheduler_EDF_SMP_Update_priority
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
_Scheduler_EDF_SMP_Unpin
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
_Scheduler_EDF_SMP_Unblock
void _Scheduler_EDF_SMP_Unblock(const Scheduler_Control *scheduler, Thread_Control *thread, Scheduler_Node *node)
Unblocks the thread.
Definition: scheduleredfsmp.c:476
_Scheduler_EDF_SMP_Initialize
void _Scheduler_EDF_SMP_Initialize(const Scheduler_Control *scheduler)
Initializes the context of the scheduler control.
Definition: scheduleredfsmp.c:61
_Scheduler_EDF_SMP_Block
void _Scheduler_EDF_SMP_Block(const Scheduler_Control *scheduler, Thread_Control *thread, Scheduler_Node *node)
Blocks the thread.
Definition: scheduleredfsmp.c:417
_Scheduler_EDF_SMP_Remove_processor
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
_Scheduler_EDF_SMP_Pin
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
_Scheduler_EDF_SMP_Ask_for_help
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
_Scheduler_EDF_SMP_Reconsider_help_request
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
_Scheduler_EDF_SMP_Add_processor
void _Scheduler_EDF_SMP_Add_processor(const Scheduler_Control *scheduler, Thread_Control *idle)
Adds processor.
Definition: scheduleredfsmp.c:594
_Scheduler_EDF_SMP_Withdraw_node
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
scheduleredf.h
Data Related to the Manipulation of Threads for the EDF Scheduler.
schedulersmp.h
SMP Scheduler API.
scheduler.h
Constants and Structures Associated with the Scheduler.
Chain_Node_struct
Definition: chain.h:68
Per_CPU_Control
Per CPU Core Structure.
Definition: percpu.h:347
Scheduler_EDF_SMP_Context
Definition: scheduleredfsmp.h:85
Scheduler_EDF_SMP_Context::Affine_queues
Chain_Control Affine_queues
Chain of ready queues with affine threads to determine the highest priority ready thread.
Definition: scheduleredfsmp.h:97
Scheduler_EDF_SMP_Node
Definition: scheduleredfsmp.h:38
Scheduler_EDF_SMP_Node::generation
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::affinity_ready_queue_index
uint8_t affinity_ready_queue_index
Ready queue index according to thread affinity.
Definition: scheduleredfsmp.h:60
Scheduler_EDF_SMP_Node::pinning_ready_queue_index
uint8_t pinning_ready_queue_index
Ready queue index according to thread pinning.
Definition: scheduleredfsmp.h:65
Scheduler_EDF_SMP_Node::ready_queue_index
uint8_t ready_queue_index
The ready queue index depending on the processor affinity and pinning of the thread.
Definition: scheduleredfsmp.h:55
Scheduler_EDF_SMP_Ready_queue
Definition: scheduleredfsmp.h:68
Scheduler_EDF_SMP_Ready_queue::Queue
RBTree_Control Queue
The ready threads of the corresponding affinity.
Definition: scheduleredfsmp.h:77
Scheduler_EDF_SMP_Ready_queue::scheduled
Scheduler_EDF_SMP_Node * scheduled
The scheduled thread of the corresponding processor.
Definition: scheduleredfsmp.h:82
Scheduler_EDF_SMP_Ready_queue::Node
Chain_Node Node
Chain node for Scheduler_SMP_Context::Affine_queues.
Definition: scheduleredfsmp.h:72
Scheduler_Node
Scheduler node for per-thread data.
Definition: schedulernode.h:79
Scheduler_SMP_Context
Scheduler context specialization for SMP schedulers.
Definition: schedulersmp.h:46
Scheduler_SMP_Node
Scheduler node specialization for SMP schedulers.
Definition: schedulersmp.h:100
_Scheduler_Control
Scheduler control.
Definition: scheduler.h:269
_Thread_Control
Definition: thread.h:732
Chain_Control
Definition: chain.h:86