source: rtems/cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h @ 77ff5599

5
Last change on this file since 77ff5599 was 77ff5599, checked in by Sebastian Huber <sebastian.huber@…>, on 06/10/16 at 06:48:54

score: Introduce map priority scheduler operation

Introduce map/unmap priority scheduler operations to map thread priority
values from/to the user domain to/from the scheduler domain. Use the
map priority operation to validate the thread priority. The EDF
schedulers use this new operation to distinguish between normal
priorities and priorities obtain through a job release.

Update #2173.
Update #2556.

  • Property mode set to 100644
File size: 5.6 KB
Line 
1/**
2 * @file
3 *
4 * @ingroup ScoreSchedulerPriorityAffinitySMP
5 *
6 * @brief Deterministic Priority Affinity SMP Scheduler API
7 */
8
9/*
10 *  COPYRIGHT (c) 2014.
11 *  On-Line Applications Research Corporation (OAR).
12 *
13 *  The license and distribution terms for this file may be
14 *  found in the file LICENSE in this distribution or at
15 *  http://www.rtems.org/license/LICENSE.
16 */
17
18#ifndef _RTEMS_SCORE_SCHEDULERPRIORITYAFFINITYSMP_H
19#define _RTEMS_SCORE_SCHEDULERPRIORITYAFFINITYSMP_H
20
21#include <rtems/score/scheduler.h>
22#include <rtems/score/schedulerpriority.h>
23#include <rtems/score/schedulersmp.h>
24#include <rtems/score/schedulerprioritysmp.h>
25#include <rtems/score/cpuset.h>
26
27#ifdef __cplusplus
28extern "C" {
29#endif /* __cplusplus */
30
31/**
32 * @defgroup ScoreSchedulerPriorityAffinitySMP Deterministic Priority Affinity SMP Scheduler
33 *
34 * @ingroup ScoreSchedulerPrioritySMP
35 *
36 * This is an extension of the Deterministic Priority SMP Scheduler. which
37 * is an implementation of the global fixed priority scheduler (G-FP).
38 * It adds thread to core affinity support.
39 *
40 * @note This is the first iteration of this scheduler. It currently tracks
41 *       the requested affinity to exercise the Scheduler Framework but it
42 *       does not honor that affinity in assigning threads to cores. This
43 *       will be added in a subsequent revision.
44 * @{
45 */
46
47/**
48 * @brief Entry points for the Deterministic Priority Affinity SMP Scheduler.
49 */
50#define SCHEDULER_PRIORITY_AFFINITY_SMP_ENTRY_POINTS \
51  { \
52    _Scheduler_priority_SMP_Initialize, \
53    _Scheduler_default_Schedule, \
54    _Scheduler_priority_SMP_Yield, \
55    _Scheduler_priority_affinity_SMP_Block, \
56    _Scheduler_priority_affinity_SMP_Unblock, \
57    _Scheduler_priority_affinity_SMP_Change_priority, \
58    _Scheduler_default_Map_priority, \
59    _Scheduler_default_Unmap_priority, \
60    _Scheduler_priority_affinity_SMP_Ask_for_help, \
61    _Scheduler_priority_affinity_SMP_Node_initialize, \
62    _Scheduler_default_Node_destroy, \
63    _Scheduler_priority_SMP_Update_priority, \
64    _Scheduler_default_Release_job, \
65    _Scheduler_default_Tick, \
66    _Scheduler_SMP_Start_idle, \
67    _Scheduler_priority_affinity_SMP_Get_affinity, \
68    _Scheduler_priority_affinity_SMP_Set_affinity \
69  }
70
71/**
72 *  @brief Initializes per thread scheduler information
73 *
74 *  This routine allocates @a thread->scheduler.
75 *
76 *  @param[in] scheduler points to the scheduler specific information.
77 *  @param[in] thread is the thread the scheduler is allocating
78 *             management memory for.
79 */
80void _Scheduler_priority_affinity_SMP_Node_initialize(
81  const Scheduler_Control *scheduler,
82  Thread_Control          *thread
83);
84
85/**
86 * @brief SMP Priority Affinity Scheduler Block Operation
87 *
88 * This method is the block operation for this scheduler.
89 *
90 * @param[in] scheduler is the scheduler instance information
91 * @param[in] thread is the thread to block
92 */
93void _Scheduler_priority_affinity_SMP_Block(
94  const Scheduler_Control *scheduler,
95  Thread_Control          *thread
96);
97
98/**
99 * @brief SMP Priority Affinity Scheduler Unblock Operation
100 *
101 * This method is the unblock operation for this scheduler.
102 *
103 * @param[in] scheduler is the scheduler instance information
104 * @param[in] thread is the thread to unblock
105 */
106Thread_Control *_Scheduler_priority_affinity_SMP_Unblock(
107  const Scheduler_Control *scheduler,
108  Thread_Control          *thread
109);
110
111/**
112 * @brief Get affinity for the priority affinity SMP scheduler.
113 *
114 * @param[in] scheduler The scheduler of the thread.
115 * @param[in] thread The associated thread.
116 * @param[in] cpusetsize The size of the cpuset.
117 * @param[in,out] cpuset The associated affinity set.
118 *
119 * @retval 0 Successfully got cpuset
120 * @retval -1 The cpusetsize is invalid for the system
121 */
122bool _Scheduler_priority_affinity_SMP_Get_affinity(
123  const Scheduler_Control *scheduler,
124  Thread_Control          *thread,
125  size_t                   cpusetsize,
126  cpu_set_t               *cpuset
127);
128
129/**
130 * @brief Change priority for the priority affinity SMP scheduler.
131 *
132 * @param[in] scheduler The scheduler of the thread.
133 * @param[in] the_thread The associated thread.
134 * @param[in] new_priority The new priority for the thread.
135 * @param[in] prepend_it Append or prepend the thread to its priority FIFO.
136 */
137Thread_Control *_Scheduler_priority_affinity_SMP_Change_priority(
138  const Scheduler_Control *scheduler,
139  Thread_Control          *the_thread,
140  Priority_Control         new_priority,
141  bool                     prepend_it
142);
143
144Thread_Control *_Scheduler_priority_affinity_SMP_Ask_for_help(
145  const Scheduler_Control *scheduler,
146  Thread_Control          *offers_help,
147  Thread_Control          *needs_help
148);
149
150/**
151 * @brief Set affinity for the priority affinity SMP scheduler.
152 *
153 * @param[in] scheduler The scheduler of the thread.
154 * @param[in] thread The associated thread.
155 * @param[in] cpusetsize The size of the cpuset.
156 * @param[in] cpuset Affinity new affinity set.
157 *
158 * @retval true if successful
159 * @retval false if unsuccessful
160 */
161bool _Scheduler_priority_affinity_SMP_Set_affinity(
162  const Scheduler_Control *scheduler,
163  Thread_Control          *thread,
164  size_t                   cpusetsize,
165  const cpu_set_t         *cpuset
166);
167
168/**
169 * @brief Scheduler node specialization for Deterministic Priority Affinity SMP
170 * schedulers.
171 *
172 * This is a per thread structure.
173 */
174typedef struct {
175  /**
176   * @brief SMP priority scheduler node.
177   */
178  Scheduler_priority_SMP_Node Base;
179
180  /**
181   * Structure containing affinity set data and size
182   */
183  CPU_set_Control Affinity;
184} Scheduler_priority_affinity_SMP_Node;
185
186/** @} */
187
188#ifdef __cplusplus
189}
190#endif /* __cplusplus */
191
192#endif /* _RTEMS_SCORE_SCHEDULERPRIORITYAFFINITYSMP_H */
Note: See TracBrowser for help on using the repository browser.