summaryrefslogtreecommitdiffstats
path: root/cpukit/score/include/rtems/score
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-09-30 14:38:04 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-11-02 10:05:40 +0100
commit501043a18bae037ca7195ce6989d3ffa8cc72660 (patch)
tree57e5051298373efcf465be0d0675a0efce50c80f /cpukit/score/include/rtems/score
parentscore: Rename scheduler ask for help stuff (diff)
downloadrtems-501043a18bae037ca7195ce6989d3ffa8cc72660.tar.bz2
score: Pass scheduler node to update priority op
This enables to call this scheduler operation for all scheduler nodes available to a thread. Update #2556.
Diffstat (limited to 'cpukit/score/include/rtems/score')
-rw-r--r--cpukit/score/include/rtems/score/scheduler.h3
-rw-r--r--cpukit/score/include/rtems/score/scheduleredf.h3
-rw-r--r--cpukit/score/include/rtems/score/schedulerimpl.h28
-rw-r--r--cpukit/score/include/rtems/score/schedulerpriority.h3
-rw-r--r--cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h3
-rw-r--r--cpukit/score/include/rtems/score/schedulerprioritysmp.h3
-rw-r--r--cpukit/score/include/rtems/score/schedulersimple.h3
-rw-r--r--cpukit/score/include/rtems/score/schedulersimplesmp.h3
-rw-r--r--cpukit/score/include/rtems/score/schedulersmpimpl.h52
-rw-r--r--cpukit/score/include/rtems/score/schedulerstrongapa.h3
10 files changed, 66 insertions, 38 deletions
diff --git a/cpukit/score/include/rtems/score/scheduler.h b/cpukit/score/include/rtems/score/scheduler.h
index e85b7f8c34..0fc7d5a880 100644
--- a/cpukit/score/include/rtems/score/scheduler.h
+++ b/cpukit/score/include/rtems/score/scheduler.h
@@ -83,7 +83,8 @@ typedef struct {
/** @see _Scheduler_Update_priority() */
Scheduler_Void_or_thread ( *update_priority )(
const Scheduler_Control *,
- Thread_Control *
+ Thread_Control *,
+ Scheduler_Node *
);
/** @see _Scheduler_Map_priority() */
diff --git a/cpukit/score/include/rtems/score/scheduleredf.h b/cpukit/score/include/rtems/score/scheduleredf.h
index ab43672ec1..0ae33cf359 100644
--- a/cpukit/score/include/rtems/score/scheduleredf.h
+++ b/cpukit/score/include/rtems/score/scheduleredf.h
@@ -171,7 +171,8 @@ Scheduler_Void_or_thread _Scheduler_EDF_Unblock(
Scheduler_Void_or_thread _Scheduler_EDF_Update_priority(
const Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ Thread_Control *the_thread,
+ Scheduler_Node *node
);
Priority_Control _Scheduler_EDF_Map_priority(
diff --git a/cpukit/score/include/rtems/score/schedulerimpl.h b/cpukit/score/include/rtems/score/schedulerimpl.h
index e44dd4fbbb..211b7a7fd9 100644
--- a/cpukit/score/include/rtems/score/schedulerimpl.h
+++ b/cpukit/score/include/rtems/score/schedulerimpl.h
@@ -136,6 +136,17 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Release_critical(
_ISR_lock_Release( &_Scheduler_Lock, lock_context );
}
+RTEMS_INLINE_ROUTINE Scheduler_Node *_Scheduler_Thread_get_node(
+ const Thread_Control *the_thread
+)
+{
+#if defined(RTEMS_SMP)
+ return the_thread->Scheduler.node;
+#else
+ return the_thread->Scheduler.nodes;
+#endif
+}
+
/**
* The preferred method to add a new scheduler is to define the jump table
* entries and add a case to the _Scheduler_Initialize routine.
@@ -381,7 +392,11 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Update_priority( Thread_Control *the_thread
#if defined(RTEMS_SMP)
needs_help =
#endif
- ( *own_scheduler->Operations.update_priority )( own_scheduler, the_thread );
+ ( *own_scheduler->Operations.update_priority )(
+ own_scheduler,
+ the_thread,
+ _Thread_Scheduler_get_home_node( the_thread )
+ );
#if defined(RTEMS_SMP)
_Scheduler_Ask_for_help_if_necessary( needs_help );
@@ -768,17 +783,6 @@ RTEMS_INLINE_ROUTINE uint32_t _Scheduler_Get_index(
return (uint32_t) (scheduler - &_Scheduler_Table[ 0 ]);
}
-RTEMS_INLINE_ROUTINE Scheduler_Node *_Scheduler_Thread_get_node(
- const Thread_Control *the_thread
-)
-{
-#if defined(RTEMS_SMP)
- return the_thread->Scheduler.node;
-#else
- return the_thread->Scheduler.nodes;
-#endif
-}
-
RTEMS_INLINE_ROUTINE void _Scheduler_Thread_set_priority(
Thread_Control *the_thread,
Priority_Control new_priority,
diff --git a/cpukit/score/include/rtems/score/schedulerpriority.h b/cpukit/score/include/rtems/score/schedulerpriority.h
index f3e805a43b..4c9c698830 100644
--- a/cpukit/score/include/rtems/score/schedulerpriority.h
+++ b/cpukit/score/include/rtems/score/schedulerpriority.h
@@ -155,7 +155,8 @@ Scheduler_Void_or_thread _Scheduler_priority_Unblock(
Scheduler_Void_or_thread _Scheduler_priority_Update_priority(
const Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ Thread_Control *the_thread,
+ Scheduler_Node *base_node
);
void _Scheduler_priority_Node_initialize(
diff --git a/cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h b/cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h
index 4d06bcb43a..be28deca28 100644
--- a/cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h
+++ b/cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h
@@ -138,7 +138,8 @@ bool _Scheduler_priority_affinity_SMP_Get_affinity(
*/
Thread_Control *_Scheduler_priority_affinity_SMP_Update_priority(
const Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ Thread_Control *the_thread,
+ Scheduler_Node *node
);
Thread_Control *_Scheduler_priority_affinity_SMP_Ask_for_help_X(
diff --git a/cpukit/score/include/rtems/score/schedulerprioritysmp.h b/cpukit/score/include/rtems/score/schedulerprioritysmp.h
index 4bd779557f..afde45b82d 100644
--- a/cpukit/score/include/rtems/score/schedulerprioritysmp.h
+++ b/cpukit/score/include/rtems/score/schedulerprioritysmp.h
@@ -117,7 +117,8 @@ Thread_Control *_Scheduler_priority_SMP_Unblock(
Thread_Control *_Scheduler_priority_SMP_Update_priority(
const Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ Thread_Control *the_thread,
+ Scheduler_Node *node
);
Thread_Control *_Scheduler_priority_SMP_Ask_for_help_X(
diff --git a/cpukit/score/include/rtems/score/schedulersimple.h b/cpukit/score/include/rtems/score/schedulersimple.h
index 22393790bc..5d610691a6 100644
--- a/cpukit/score/include/rtems/score/schedulersimple.h
+++ b/cpukit/score/include/rtems/score/schedulersimple.h
@@ -147,7 +147,8 @@ Scheduler_Void_or_thread _Scheduler_simple_Unblock(
Scheduler_Void_or_thread _Scheduler_simple_Update_priority(
const Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ Thread_Control *the_thread,
+ Scheduler_Node *node
);
/**@}*/
diff --git a/cpukit/score/include/rtems/score/schedulersimplesmp.h b/cpukit/score/include/rtems/score/schedulersimplesmp.h
index 6d2b77c2e9..42734455b1 100644
--- a/cpukit/score/include/rtems/score/schedulersimplesmp.h
+++ b/cpukit/score/include/rtems/score/schedulersimplesmp.h
@@ -100,7 +100,8 @@ Thread_Control *_Scheduler_simple_SMP_Unblock(
Thread_Control *_Scheduler_simple_SMP_Update_priority(
const Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ Thread_Control *the_thread,
+ Scheduler_Node *node
);
Thread_Control *_Scheduler_simple_SMP_Ask_for_help_X(
diff --git a/cpukit/score/include/rtems/score/schedulersmpimpl.h b/cpukit/score/include/rtems/score/schedulersmpimpl.h
index 4e4edf75a1..cec0357f32 100644
--- a/cpukit/score/include/rtems/score/schedulersmpimpl.h
+++ b/cpukit/score/include/rtems/score/schedulersmpimpl.h
@@ -385,6 +385,20 @@ static inline Scheduler_SMP_Node *_Scheduler_SMP_Node_downcast(
return (Scheduler_SMP_Node *) node;
}
+static inline Scheduler_SMP_Node_state _Scheduler_SMP_Node_state(
+ const Scheduler_Node *node
+)
+{
+ return ( (const Scheduler_SMP_Node *) node )->state;
+}
+
+static inline Priority_Control _Scheduler_SMP_Node_priority(
+ const Scheduler_Node *node
+)
+{
+ return ( (const Scheduler_SMP_Node *) node )->priority;
+}
+
static inline void _Scheduler_SMP_Node_initialize(
const Scheduler_Control *scheduler,
Scheduler_SMP_Node *node,
@@ -963,6 +977,7 @@ static inline Thread_Control *_Scheduler_SMP_Unblock(
static inline Thread_Control *_Scheduler_SMP_Update_priority(
Scheduler_Context *context,
Thread_Control *thread,
+ Scheduler_Node *node,
Scheduler_SMP_Extract extract_from_ready,
Scheduler_SMP_Update update,
Scheduler_SMP_Enqueue enqueue_fifo,
@@ -971,41 +986,42 @@ static inline Thread_Control *_Scheduler_SMP_Update_priority(
Scheduler_SMP_Enqueue_scheduled enqueue_scheduled_lifo
)
{
- Scheduler_SMP_Node *node;
- Thread_Control *needs_help;
- Priority_Control new_priority;
- bool prepend_it;
+ Thread_Control *needs_help;
+ Priority_Control new_priority;
+ bool prepend_it;
+ Scheduler_SMP_Node_state node_state;
- node = _Scheduler_SMP_Thread_get_own_node( thread );
- new_priority = _Scheduler_Node_get_priority( &node->Base, &prepend_it );
+ new_priority = _Scheduler_Node_get_priority( node, &prepend_it );
- if ( new_priority == node->priority ) {
+ if ( new_priority == _Scheduler_SMP_Node_priority( node ) ) {
/* Nothing to do */
return NULL;
}
- if ( node->state == SCHEDULER_SMP_NODE_SCHEDULED ) {
- _Scheduler_SMP_Extract_from_scheduled( &node->Base );
+ node_state = _Scheduler_SMP_Node_state( node );
+
+ if ( node_state == SCHEDULER_SMP_NODE_SCHEDULED ) {
+ _Scheduler_SMP_Extract_from_scheduled( node );
- ( *update )( context, &node->Base, new_priority );
+ ( *update )( context, node, new_priority );
if ( prepend_it ) {
- needs_help = ( *enqueue_scheduled_lifo )( context, &node->Base );
+ needs_help = ( *enqueue_scheduled_lifo )( context, node );
} else {
- needs_help = ( *enqueue_scheduled_fifo )( context, &node->Base );
+ needs_help = ( *enqueue_scheduled_fifo )( context, node );
}
- } else if ( node->state == SCHEDULER_SMP_NODE_READY ) {
- ( *extract_from_ready )( context, &node->Base );
+ } else if ( node_state == SCHEDULER_SMP_NODE_READY ) {
+ ( *extract_from_ready )( context, node );
- ( *update )( context, &node->Base, new_priority );
+ ( *update )( context, node, new_priority );
if ( prepend_it ) {
- needs_help = ( *enqueue_lifo )( context, &node->Base, NULL );
+ needs_help = ( *enqueue_lifo )( context, node, NULL );
} else {
- needs_help = ( *enqueue_fifo )( context, &node->Base, NULL );
+ needs_help = ( *enqueue_fifo )( context, node, NULL );
}
} else {
- ( *update )( context, &node->Base, new_priority );
+ ( *update )( context, node, new_priority );
needs_help = NULL;
}
diff --git a/cpukit/score/include/rtems/score/schedulerstrongapa.h b/cpukit/score/include/rtems/score/schedulerstrongapa.h
index 4dfc2ff2c8..35d3eddee2 100644
--- a/cpukit/score/include/rtems/score/schedulerstrongapa.h
+++ b/cpukit/score/include/rtems/score/schedulerstrongapa.h
@@ -117,7 +117,8 @@ Thread_Control *_Scheduler_strong_APA_Unblock(
Thread_Control *_Scheduler_strong_APA_Update_priority(
const Scheduler_Control *scheduler,
- Thread_Control *the_thread
+ Thread_Control *the_thread,
+ Scheduler_Node *node
);
Thread_Control *_Scheduler_strong_APA_Ask_for_help_X(