source: rtems/cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h @ 5b1ff71a

4.115
Last change on this file since 5b1ff71a was 5b1ff71a, checked in by Sebastian Huber <sebastian.huber@…>, on 05/13/14 at 13:57:43

score: Scheduler documentation

  • Property mode set to 100644
File size: 4.2 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_priority_SMP_Schedule, \
54    _Scheduler_priority_SMP_Yield, \
55    _Scheduler_priority_SMP_Block, \
56    _Scheduler_priority_SMP_Enqueue_fifo, \
57    _Scheduler_priority_affinity_SMP_Allocate, \
58    _Scheduler_default_Free, \
59    _Scheduler_priority_SMP_Update, \
60    _Scheduler_priority_SMP_Enqueue_fifo, \
61    _Scheduler_priority_SMP_Enqueue_lifo, \
62    _Scheduler_priority_SMP_Extract, \
63    _Scheduler_priority_Priority_compare, \
64    _Scheduler_default_Release_job, \
65    _Scheduler_default_Tick, \
66    _Scheduler_priority_SMP_Start_idle, \
67    _Scheduler_priority_affinity_SMP_Get_affinity, \
68    _Scheduler_priority_affinity_SMP_Set_affinity \
69  }
70
71/**
72 *  @brief Allocates @a the_thread->scheduler.
73 *
74 *  This routine allocates @a the_thread->scheduler.
75 *
76 *  @param[in] scheduler points to the scheduler specific information.
77 *  @param[in] the_thread is the thread the scheduler is allocating
78 *             management memory for.
79 */
80bool _Scheduler_priority_affinity_SMP_Allocate(
81  const Scheduler_Control *scheduler,
82  Thread_Control          *the_thread
83);
84
85/**
86 * @brief Get affinity for the priority affinity smp scheduler.
87 *
88 * @param[in] scheduler The scheduler of the thread.
89 * @param[in] thread The associated thread.
90 * @param[in] cpusetsize The size of the cpuset.
91 * @param[in,out] cpuset The associated affinity set.
92 *
93 * @retval 0 Successfully got cpuset
94 * @retval -1 The cpusetsize is invalid for the system
95 */
96bool _Scheduler_priority_affinity_SMP_Get_affinity(
97  const Scheduler_Control *scheduler,
98  Thread_Control          *thread,
99  size_t                   cpusetsize,
100  cpu_set_t               *cpuset
101);
102
103/**
104 * @brief Set affinity for the priority affinity smp scheduler.
105 *
106 * @param[in] scheduler The scheduler of the thread.
107 * @param[in] thread The associated thread.
108 * @param[in] cpusetsize The size of the cpuset.
109 * @param[in] cpuset Affinity new affinity set.
110 *
111 * @retval 0 Successful
112 */
113bool _Scheduler_priority_affinity_SMP_Set_affinity(
114  const Scheduler_Control *scheduler,
115  Thread_Control          *thread,
116  size_t                   cpusetsize,
117  cpu_set_t               *cpuset
118);
119
120/**
121 * This structure handles affinity specific data of a thread.
122 *
123 * @note The attribute priority_sched_info must remain
124 *       the first element in the structure so that the
125 *       Scheduler_priority_XXX methods will continue to
126 *       function.
127 */
128typedef struct {
129
130  /**
131   * Data for the Priority Scheduler.
132   */
133  Scheduler_priority_Per_thread  Priority_sched_info;
134
135  /**
136   * Structure containing affinity set data and size
137   */
138  CPU_set_Control Affinity;
139} Scheduler_priority_affinity_SMP_Per_thread;
140
141/** @} */
142
143#ifdef __cplusplus
144}
145#endif /* __cplusplus */
146
147#endif /* _RTEMS_SCORE_SCHEDULERPRIORITYSMP_H */
Note: See TracBrowser for help on using the repository browser.