source: rtems/cpukit/score/include/rtems/score/schedulersmp.h @ f39f667a

4.115
Last change on this file since f39f667a was f39f667a, checked in by Sebastian Huber <sebastian.huber@…>, on 05/14/14 at 11:50:48

score: Simplify _Thread_Change_priority()

The function to change a thread priority was too complex. Simplify it
with a new scheduler operation. This increases the average case
performance due to the simplified logic. The interrupt disabled
critical section is a bit prolonged since now the extract, update and
enqueue steps are executed atomically. This should however not impact
the worst-case interrupt latency since at least for the Deterministic
Priority Scheduler this sequence can be carried out with a wee bit of
instructions and no loops.

Add _Scheduler_Change_priority() to replace the sequence of

  • _Thread_Set_transient(),
  • _Scheduler_Extract(),
  • _Scheduler_Enqueue(), and
  • _Scheduler_Enqueue_first().

Delete STATES_TRANSIENT, _States_Is_transient() and
_Thread_Set_transient() since this state is now superfluous.

With this change it is possible to get rid of the
SCHEDULER_SMP_NODE_IN_THE_AIR state. This considerably simplifies the
implementation of the new SMP locking protocols.

  • Property mode set to 100644
File size: 2.2 KB
Line 
1/**
2 * @file
3 *
4 * @brief SMP Scheduler API
5 *
6 * @ingroup ScoreSchedulerSMP
7 */
8
9/*
10 * Copyright (c) 2013-2014 embedded brains GmbH.  All rights reserved.
11 *
12 *  embedded brains GmbH
13 *  Dornierstr. 4
14 *  82178 Puchheim
15 *  Germany
16 *  <rtems@embedded-brains.de>
17 *
18 * The license and distribution terms for this file may be
19 * found in the file LICENSE in this distribution or at
20 * http://www.rtems.org/license/LICENSE.
21 */
22
23#ifndef _RTEMS_SCORE_SCHEDULERSMP_H
24#define _RTEMS_SCORE_SCHEDULERSMP_H
25
26#include <rtems/score/chain.h>
27#include <rtems/score/scheduler.h>
28
29#ifdef __cplusplus
30extern "C" {
31#endif /* __cplusplus */
32
33/**
34 * @defgroup ScoreSchedulerSMP SMP Scheduler
35 *
36 * @ingroup ScoreScheduler
37 *
38 * @{
39 */
40
41/**
42 * @brief Scheduler context specialization for SMP schedulers.
43 */
44typedef struct {
45  /**
46   * @brief Basic scheduler context.
47   */
48  Scheduler_Context Base;
49
50  /**
51   * @brief The chain of scheduled nodes.
52   */
53  Chain_Control Scheduled;
54} Scheduler_SMP_Context;
55
56/**
57 * @brief SMP scheduler node states.
58 */
59typedef enum {
60  /**
61   * @brief This scheduler node is blocked.
62   *
63   * A scheduler node is blocked if the corresponding thread is not ready.
64   */
65  SCHEDULER_SMP_NODE_BLOCKED,
66
67  /**
68   * @brief The scheduler node is scheduled.
69   *
70   * A scheduler node is scheduled if the corresponding thread is ready and the
71   * scheduler allocated a processor for it.  A scheduled node is assigned to
72   * exactly one processor.  The count of scheduled nodes in this scheduler
73   * instance equals the processor count owned by the scheduler instance.
74   */
75  SCHEDULER_SMP_NODE_SCHEDULED,
76
77  /**
78   * @brief This scheduler node is ready.
79   *
80   * A scheduler node is ready if the corresponding thread is ready and the
81   * scheduler did not allocate a processor for it.
82   */
83  SCHEDULER_SMP_NODE_READY
84} Scheduler_SMP_Node_state;
85
86/**
87 * @brief Scheduler node specialization for SMP schedulers.
88 */
89typedef struct {
90  /**
91   * @brief Basic scheduler node.
92   */
93  Scheduler_Node Base;
94
95  /**
96   * @brief The state of this node.
97   */
98  Scheduler_SMP_Node_state state;
99} Scheduler_SMP_Node;
100
101/** @} */
102
103#ifdef __cplusplus
104}
105#endif /* __cplusplus */
106
107#endif /* _RTEMS_SCORE_SCHEDULERSMP_H */
Note: See TracBrowser for help on using the repository browser.