summaryrefslogtreecommitdiffstats
path: root/cpukit/score
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-10-21 09:23:48 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-11-02 10:05:44 +0100
commit97f7dac6604b448f0c4ee10f02d192ea42bc6aaa (patch)
tree421ac9688314c85498c8a3f70bcd2fa659120b50 /cpukit/score
parentscore: Delete unused functions (diff)
downloadrtems-97f7dac6604b448f0c4ee10f02d192ea42bc6aaa.tar.bz2
score: Delete _Scheduler_Ask_for_help_if_necessary
Delete Thread_Control::Resource_node. Update #2556.
Diffstat (limited to '')
-rw-r--r--cpukit/score/include/rtems/score/schedulerimpl.h100
-rw-r--r--cpukit/score/include/rtems/score/thread.h8
-rw-r--r--cpukit/score/include/rtems/score/threadimpl.h19
-rw-r--r--cpukit/score/src/threadinitialize.c2
4 files changed, 3 insertions, 126 deletions
diff --git a/cpukit/score/include/rtems/score/schedulerimpl.h b/cpukit/score/include/rtems/score/schedulerimpl.h
index b179f6794d..74cfb58e78 100644
--- a/cpukit/score/include/rtems/score/schedulerimpl.h
+++ b/cpukit/score/include/rtems/score/schedulerimpl.h
@@ -196,100 +196,6 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Schedule( Thread_Control *the_thread )
_Scheduler_Release_critical( scheduler, &lock_context );
}
-#if defined(RTEMS_SMP)
-typedef struct {
- Thread_Control *needs_help;
- Thread_Control *next_needs_help;
-} Scheduler_Ask_for_help_context ;
-
-RTEMS_INLINE_ROUTINE bool _Scheduler_Ask_for_help_visitor(
- Resource_Node *resource_node,
- void *arg
-)
-{
- bool done;
- Scheduler_Ask_for_help_context *help_context = arg;
- Thread_Control *previous_needs_help = help_context->needs_help;
- Thread_Control *next_needs_help;
- Thread_Control *offers_help =
- THREAD_RESOURCE_NODE_TO_THREAD( resource_node );
- const Scheduler_Control *scheduler = _Scheduler_Get_own( offers_help );
-
- next_needs_help = ( *scheduler->Operations.ask_for_help_X )(
- scheduler,
- offers_help,
- previous_needs_help
- );
-
- done = next_needs_help != previous_needs_help;
-
- if ( done ) {
- help_context->next_needs_help = next_needs_help;
- }
-
- return done;
-}
-
-/**
- * @brief Ask threads depending on resources owned by the thread for help.
- *
- * A thread is in need for help if it lost its assigned processor due to
- * pre-emption by a higher priority thread or it was not possible to assign it
- * a processor since its priority is to low on its current scheduler instance.
- *
- * The run-time of this function depends on the size of the resource tree of
- * the thread needing help and other resource trees in case threads in need for
- * help are produced during this operation.
- *
- * @param[in] needs_help The thread needing help.
- */
-RTEMS_INLINE_ROUTINE void _Scheduler_Ask_for_help_X(
- Thread_Control *needs_help
-)
-{
- do {
- const Scheduler_Control *scheduler = _Scheduler_Get_own( needs_help );
-
- needs_help = ( *scheduler->Operations.ask_for_help_X )(
- scheduler,
- needs_help,
- needs_help
- );
-
- if ( needs_help != NULL ) {
- Scheduler_Ask_for_help_context help_context = { needs_help, NULL };
-
- _Resource_Iterate(
- &needs_help->Resource_node,
- _Scheduler_Ask_for_help_visitor,
- &help_context
- );
-
- needs_help = help_context.next_needs_help;
- }
- } while ( needs_help != NULL );
-}
-
-RTEMS_INLINE_ROUTINE void _Scheduler_Ask_for_help_if_necessary(
- Thread_Control *needs_help
-)
-{
- if (
- needs_help != NULL
- && _Resource_Node_owns_resources( &needs_help->Resource_node )
- ) {
- Scheduler_Node *node = _Thread_Scheduler_get_own_node( needs_help );
-
- if (
- node->help_state != SCHEDULER_HELP_ACTIVE_RIVAL
- || _Scheduler_Node_get_user( node ) != needs_help
- ) {
- _Scheduler_Ask_for_help_X( needs_help );
- }
- }
-}
-#endif
-
/**
* @brief Scheduler yield with a particular thread.
*
@@ -320,7 +226,6 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Yield( Thread_Control *the_thread )
the_thread,
_Thread_Scheduler_get_home_node( the_thread )
);
- _Scheduler_Ask_for_help_if_necessary( needs_help );
_Scheduler_Release_critical( scheduler, &lock_context );
if ( needs_help != the_thread ) {
@@ -455,7 +360,6 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Unblock( Thread_Control *the_thread )
the_thread,
scheduler_node
);
- _Scheduler_Ask_for_help_if_necessary( needs_help );
_Scheduler_Release_critical( scheduler, &lock_context );
if ( needs_help != the_thread ) {
@@ -525,18 +429,16 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Update_priority( Thread_Control *the_thread
Scheduler_Node *scheduler_node;
const Scheduler_Control *scheduler;
ISR_lock_Context lock_context;
- Thread_Control *needs_help;
scheduler_node = SCHEDULER_NODE_OF_THREAD_SCHEDULER_NODE( node );
scheduler = _Scheduler_Node_get_scheduler( scheduler_node );
_Scheduler_Acquire_critical( scheduler, &lock_context );
- needs_help = ( *scheduler->Operations.update_priority )(
+ ( *scheduler->Operations.update_priority )(
scheduler,
the_thread,
scheduler_node
);
- _Scheduler_Ask_for_help_if_necessary( needs_help );
_Scheduler_Release_critical( scheduler, &lock_context );
node = _Chain_Next( node );
diff --git a/cpukit/score/include/rtems/score/thread.h b/cpukit/score/include/rtems/score/thread.h
index 304f90439c..3ec61f8b5e 100644
--- a/cpukit/score/include/rtems/score/thread.h
+++ b/cpukit/score/include/rtems/score/thread.h
@@ -29,7 +29,6 @@
#include <rtems/score/isrlock.h>
#include <rtems/score/object.h>
#include <rtems/score/priority.h>
-#include <rtems/score/resource.h>
#include <rtems/score/schedulernode.h>
#include <rtems/score/stack.h>
#include <rtems/score/states.h>
@@ -769,13 +768,6 @@ struct _Thread_Control {
SMP_lock_Stats Potpourri_stats;
#endif
-#if defined(RTEMS_SMP)
- /**
- * @brief Resource node to build a dependency tree in case this thread owns
- * resources or depends on a resource.
- */
- Resource_Node Resource_node;
-#endif
#if defined(RTEMS_MULTIPROCESSING)
/** This field is true if the thread is offered globally */
bool is_global;
diff --git a/cpukit/score/include/rtems/score/threadimpl.h b/cpukit/score/include/rtems/score/threadimpl.h
index bb891bd37b..26a9d282ac 100644
--- a/cpukit/score/include/rtems/score/threadimpl.h
+++ b/cpukit/score/include/rtems/score/threadimpl.h
@@ -27,7 +27,6 @@
#include <rtems/score/interr.h>
#include <rtems/score/isr.h>
#include <rtems/score/objectimpl.h>
-#include <rtems/score/resourceimpl.h>
#include <rtems/score/schedulernodeimpl.h>
#include <rtems/score/statesimpl.h>
#include <rtems/score/status.h>
@@ -79,9 +78,6 @@ extern Thread_Control *_Thread_Allocated_fp;
#endif
#if defined(RTEMS_SMP)
-#define THREAD_RESOURCE_NODE_TO_THREAD( node ) \
- RTEMS_CONTAINER_OF( node, Thread_Control, Resource_node )
-
#define THREAD_OF_SCHEDULER_HELP_NODE( node ) \
RTEMS_CONTAINER_OF( node, Thread_Control, Scheduler.Help_node )
#endif
@@ -974,11 +970,7 @@ RTEMS_INLINE_ROUTINE bool _Thread_Is_joinable(
* @brief Returns true if the thread owns resources, and false otherwise.
*
* Resources are accounted with the Thread_Control::resource_count resource
- * counter. This counter is used by semaphore objects for example.
- *
- * In addition to the resource counter there is a resource dependency tree
- * available on SMP configurations. In case this tree is non-empty, then the
- * thread owns resources.
+ * counter. This counter is used by mutex objects for example.
*
* @param[in] the_thread The thread.
*/
@@ -986,14 +978,7 @@ RTEMS_INLINE_ROUTINE bool _Thread_Owns_resources(
const Thread_Control *the_thread
)
{
- bool owns_resources = the_thread->resource_count != 0;
-
-#if defined(RTEMS_SMP)
- owns_resources = owns_resources
- || _Resource_Node_owns_resources( &the_thread->Resource_node );
-#endif
-
- return owns_resources;
+ return the_thread->resource_count != 0;
}
#if defined(RTEMS_SMP)
diff --git a/cpukit/score/src/threadinitialize.c b/cpukit/score/src/threadinitialize.c
index 8fe1785cf5..f151989a3f 100644
--- a/cpukit/score/src/threadinitialize.c
+++ b/cpukit/score/src/threadinitialize.c
@@ -19,7 +19,6 @@
#endif
#include <rtems/score/threadimpl.h>
-#include <rtems/score/resourceimpl.h>
#include <rtems/score/schedulerimpl.h>
#include <rtems/score/stackimpl.h>
#include <rtems/score/tls.h>
@@ -237,7 +236,6 @@ bool _Thread_Initialize(
the_thread->Scheduler.control = scheduler;
the_thread->Scheduler.own_node = scheduler_node;
the_thread->Scheduler.node = scheduler_node;
- _Resource_Node_initialize( &the_thread->Resource_node );
_ISR_lock_Initialize( &the_thread->Scheduler.Lock, "Thread Scheduler" );
_ISR_lock_Initialize( &the_thread->Wait.Lock.Default, "Thread Wait Default" );
_Thread_queue_Gate_open( &the_thread->Wait.Lock.Tranquilizer );