source: rtems/cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h @ 9c238e1

5
Last change on this file since 9c238e1 was 9c238e1, checked in by Sebastian Huber <sebastian.huber@…>, on 10/21/16 at 12:33:01

score: Simplify update priority scheduler op

Remove unused return status.

  • Property mode set to 100644
File size: 5.7 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_Update_priority, \
58    _Scheduler_default_Map_priority, \
59    _Scheduler_default_Unmap_priority, \
60    _Scheduler_priority_affinity_SMP_Ask_for_help, \
61    _Scheduler_priority_affinity_SMP_Reconsider_help_request, \
62    _Scheduler_priority_affinity_SMP_Withdraw_node, \
63    _Scheduler_priority_affinity_SMP_Ask_for_help_X, \
64    _Scheduler_priority_affinity_SMP_Node_initialize, \
65    _Scheduler_default_Node_destroy, \
66    _Scheduler_default_Release_job, \
67    _Scheduler_default_Cancel_job, \
68    _Scheduler_default_Tick, \
69    _Scheduler_SMP_Start_idle, \
70    _Scheduler_priority_affinity_SMP_Get_affinity, \
71    _Scheduler_priority_affinity_SMP_Set_affinity \
72  }
73
74/**
75 *  @brief Initializes per thread scheduler information
76 *
77 *  This routine allocates @a thread->scheduler.
78 *
79 *  @param[in] scheduler points to the scheduler specific information.
80 *  @param[in] node is the node the scheduler is allocating
81 *             management memory for.
82 *  @param[in] the_thread the thread of the node.
83 *  @param[in] priority is the thread priority.
84 */
85void _Scheduler_priority_affinity_SMP_Node_initialize(
86  const Scheduler_Control *scheduler,
87  Scheduler_Node          *node,
88  Thread_Control          *the_thread,
89  Priority_Control         priority
90);
91
92void _Scheduler_priority_affinity_SMP_Block(
93  const Scheduler_Control *scheduler,
94  Thread_Control          *thread,
95  Scheduler_Node          *node
96);
97
98Thread_Control *_Scheduler_priority_affinity_SMP_Unblock(
99  const Scheduler_Control *scheduler,
100  Thread_Control          *thread,
101  Scheduler_Node          *node
102);
103
104/**
105 * @brief Get affinity for the priority affinity SMP scheduler.
106 *
107 * @param[in] scheduler The scheduler of the thread.
108 * @param[in] thread The associated thread.
109 * @param[in] cpusetsize The size of the cpuset.
110 * @param[in,out] cpuset The associated affinity set.
111 *
112 * @retval 0 Successfully got cpuset
113 * @retval -1 The cpusetsize is invalid for the system
114 */
115bool _Scheduler_priority_affinity_SMP_Get_affinity(
116  const Scheduler_Control *scheduler,
117  Thread_Control          *thread,
118  size_t                   cpusetsize,
119  cpu_set_t               *cpuset
120);
121
122void _Scheduler_priority_affinity_SMP_Update_priority(
123  const Scheduler_Control *scheduler,
124  Thread_Control          *the_thread,
125  Scheduler_Node          *node
126);
127
128bool _Scheduler_priority_affinity_SMP_Ask_for_help(
129  const Scheduler_Control *scheduler,
130  Thread_Control          *the_thread,
131  Scheduler_Node          *node
132);
133
134void _Scheduler_priority_affinity_SMP_Reconsider_help_request(
135  const Scheduler_Control *scheduler,
136  Thread_Control          *the_thread,
137  Scheduler_Node          *node
138);
139
140void _Scheduler_priority_affinity_SMP_Withdraw_node(
141  const Scheduler_Control *scheduler,
142  Thread_Control          *the_thread,
143  Scheduler_Node          *node,
144  Thread_Scheduler_state   next_state
145);
146
147Thread_Control *_Scheduler_priority_affinity_SMP_Ask_for_help_X(
148  const Scheduler_Control *scheduler,
149  Thread_Control          *offers_help,
150  Thread_Control          *needs_help
151);
152
153/**
154 * @brief Set affinity for the priority affinity SMP scheduler.
155 *
156 * @param[in] scheduler The scheduler of the thread.
157 * @param[in] thread The associated thread.
158 * @param[in] cpusetsize The size of the cpuset.
159 * @param[in] cpuset Affinity new affinity set.
160 *
161 * @retval true if successful
162 * @retval false if unsuccessful
163 */
164bool _Scheduler_priority_affinity_SMP_Set_affinity(
165  const Scheduler_Control *scheduler,
166  Thread_Control          *thread,
167  size_t                   cpusetsize,
168  const cpu_set_t         *cpuset
169);
170
171/**
172 * @brief Scheduler node specialization for Deterministic Priority Affinity SMP
173 * schedulers.
174 *
175 * This is a per thread structure.
176 */
177typedef struct {
178  /**
179   * @brief SMP priority scheduler node.
180   */
181  Scheduler_priority_SMP_Node Base;
182
183  /**
184   * Structure containing affinity set data and size
185   */
186  CPU_set_Control Affinity;
187} Scheduler_priority_affinity_SMP_Node;
188
189/** @} */
190
191#ifdef __cplusplus
192}
193#endif /* __cplusplus */
194
195#endif /* _RTEMS_SCORE_SCHEDULERPRIORITYAFFINITYSMP_H */
Note: See TracBrowser for help on using the repository browser.