source: rtems/cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h @ b2dbb634

5
Last change on this file since b2dbb634 was b2dbb634, checked in by Sebastian Huber <sebastian.huber@…>, on 10/10/17 at 09:36:23

score: Remove CPU_set_Control

Use Processor_mask instead.

Update #2514.

  • Property mode set to 100644
File size: 5.1 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
26#include <sys/cpuset.h>
27
28#ifdef __cplusplus
29extern "C" {
30#endif /* __cplusplus */
31
32/**
33 * @defgroup ScoreSchedulerPriorityAffinitySMP Deterministic Priority Affinity SMP Scheduler
34 *
35 * @ingroup ScoreSchedulerPrioritySMP
36 *
37 * This is an extension of the Deterministic Priority SMP Scheduler. which
38 * is an implementation of the global fixed priority scheduler (G-FP).
39 * It adds thread to core affinity support.
40 *
41 * @note This is the first iteration of this scheduler. It currently tracks
42 *       the requested affinity to exercise the Scheduler Framework but it
43 *       does not honor that affinity in assigning threads to cores. This
44 *       will be added in a subsequent revision.
45 * @{
46 */
47
48/**
49 * @brief Entry points for the Deterministic Priority Affinity SMP Scheduler.
50 */
51#define SCHEDULER_PRIORITY_AFFINITY_SMP_ENTRY_POINTS \
52  { \
53    _Scheduler_priority_SMP_Initialize, \
54    _Scheduler_default_Schedule, \
55    _Scheduler_priority_SMP_Yield, \
56    _Scheduler_priority_affinity_SMP_Block, \
57    _Scheduler_priority_affinity_SMP_Unblock, \
58    _Scheduler_priority_affinity_SMP_Update_priority, \
59    _Scheduler_default_Map_priority, \
60    _Scheduler_default_Unmap_priority, \
61    _Scheduler_priority_affinity_SMP_Ask_for_help, \
62    _Scheduler_priority_affinity_SMP_Reconsider_help_request, \
63    _Scheduler_priority_affinity_SMP_Withdraw_node, \
64    _Scheduler_priority_affinity_SMP_Add_processor, \
65    _Scheduler_priority_affinity_SMP_Remove_processor, \
66    _Scheduler_priority_affinity_SMP_Node_initialize, \
67    _Scheduler_default_Node_destroy, \
68    _Scheduler_default_Release_job, \
69    _Scheduler_default_Cancel_job, \
70    _Scheduler_default_Tick, \
71    _Scheduler_SMP_Start_idle, \
72    _Scheduler_priority_affinity_SMP_Set_affinity \
73  }
74
75/**
76 *  @brief Initializes per thread scheduler information
77 *
78 *  This routine allocates @a thread->scheduler.
79 *
80 *  @param[in] scheduler points to the scheduler specific information.
81 *  @param[in] node is the node the scheduler is allocating
82 *             management memory for.
83 *  @param[in] the_thread the thread of the node.
84 *  @param[in] priority is the thread priority.
85 */
86void _Scheduler_priority_affinity_SMP_Node_initialize(
87  const Scheduler_Control *scheduler,
88  Scheduler_Node          *node,
89  Thread_Control          *the_thread,
90  Priority_Control         priority
91);
92
93void _Scheduler_priority_affinity_SMP_Block(
94  const Scheduler_Control *scheduler,
95  Thread_Control          *thread,
96  Scheduler_Node          *node
97);
98
99void _Scheduler_priority_affinity_SMP_Unblock(
100  const Scheduler_Control *scheduler,
101  Thread_Control          *thread,
102  Scheduler_Node          *node
103);
104
105void _Scheduler_priority_affinity_SMP_Update_priority(
106  const Scheduler_Control *scheduler,
107  Thread_Control          *the_thread,
108  Scheduler_Node          *node
109);
110
111bool _Scheduler_priority_affinity_SMP_Ask_for_help(
112  const Scheduler_Control *scheduler,
113  Thread_Control          *the_thread,
114  Scheduler_Node          *node
115);
116
117void _Scheduler_priority_affinity_SMP_Reconsider_help_request(
118  const Scheduler_Control *scheduler,
119  Thread_Control          *the_thread,
120  Scheduler_Node          *node
121);
122
123void _Scheduler_priority_affinity_SMP_Withdraw_node(
124  const Scheduler_Control *scheduler,
125  Thread_Control          *the_thread,
126  Scheduler_Node          *node,
127  Thread_Scheduler_state   next_state
128);
129
130void _Scheduler_priority_affinity_SMP_Add_processor(
131  const Scheduler_Control *scheduler,
132  Thread_Control          *idle
133);
134
135Thread_Control *_Scheduler_priority_affinity_SMP_Remove_processor(
136  const Scheduler_Control *scheduler,
137  struct Per_CPU_Control  *cpu
138);
139
140/**
141 * @brief Set affinity for the priority affinity SMP scheduler.
142 *
143 * @param[in] scheduler The scheduler of the thread.
144 * @param[in] thread The associated thread.
145 * @param[in] affinity The new affinity set.
146 *
147 * @retval true if successful
148 * @retval false if unsuccessful
149 */
150bool _Scheduler_priority_affinity_SMP_Set_affinity(
151  const Scheduler_Control *scheduler,
152  Thread_Control          *thread,
153  Scheduler_Node          *node,
154  const Processor_mask    *affinity
155);
156
157/**
158 * @brief Scheduler node specialization for Deterministic Priority Affinity SMP
159 * schedulers.
160 *
161 * This is a per thread structure.
162 */
163typedef struct {
164  /**
165   * @brief SMP priority scheduler node.
166   */
167  Scheduler_priority_SMP_Node Base;
168
169  /**
170   * Structure containing affinity set data and size
171   */
172  cpu_set_t affinity;
173} Scheduler_priority_affinity_SMP_Node;
174
175/** @} */
176
177#ifdef __cplusplus
178}
179#endif /* __cplusplus */
180
181#endif /* _RTEMS_SCORE_SCHEDULERPRIORITYAFFINITYSMP_H */
Note: See TracBrowser for help on using the repository browser.