Ignore:
Timestamp:
Jul 10, 2014, 12:27:42 PM (6 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
f0c8501
Parents:
333f942
git-author:
Sebastian Huber <sebastian.huber@…> (07/10/14 12:27:42)
git-committer:
Sebastian Huber <sebastian.huber@…> (07/10/14 13:29:57)
Message:

score: Fix scheduler helping implementation

Do not extract the idle threads from the ready set so that there is
always a thread available for comparison.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/score/include/rtems/score/schedulersmpimpl.h

    r333f942 r27783f6  
    426426
    427427static inline Thread_Control *_Scheduler_SMP_Get_idle_thread(
    428   Scheduler_Context     *context,
    429   Scheduler_SMP_Extract  extract_from_ready
     428  Scheduler_Context *context
    430429)
    431430{
     
    433432  Thread_Control *idle = (Thread_Control *)
    434433    _Chain_Get_first_unprotected( &self->Idle_threads );
    435   Scheduler_Node *own_node = _Scheduler_Thread_get_own_node( idle );
    436 
    437   ( *extract_from_ready )( &self->Base, own_node );
    438434
    439435  _Assert( &idle->Object.Node != _Chain_Tail( &self->Idle_threads ) );
     
    443439
    444440static inline void _Scheduler_SMP_Release_idle_thread(
    445   Scheduler_Context    *context,
    446   Thread_Control       *idle,
    447   Scheduler_SMP_Insert  insert_ready
     441  Scheduler_Context *context,
     442  Thread_Control    *idle
    448443)
    449444{
    450445  Scheduler_SMP_Context *self = _Scheduler_SMP_Get_self( context );
    451   Scheduler_Node *own_node = _Scheduler_Thread_get_own_node( idle );
    452446
    453447  _Chain_Prepend_unprotected( &self->Idle_threads, &idle->Object.Node );
    454   ( *insert_ready )( context, own_node );
    455448}
    456449
     
    537530  Scheduler_SMP_Insert              insert_scheduled,
    538531  Scheduler_SMP_Move                move_from_scheduled_to_ready,
    539   Scheduler_SMP_Allocate_processor  allocate_processor,
    540   Scheduler_Release_idle_thread     release_idle_thread
     532  Scheduler_SMP_Allocate_processor  allocate_processor
    541533)
    542534{
     
    571563    context,
    572564    lowest_scheduled,
    573     release_idle_thread
     565    _Scheduler_SMP_Release_idle_thread
    574566  );
    575567  if ( idle == NULL ) {
     
    604596 * @param[in] allocate_processor Function to allocate a processor to a node
    605597 *   based on the rules of the scheduler.
    606  * @param[in] release_idle_thread Function to release an idle thread.
    607598 */
    608599static inline Thread_Control *_Scheduler_SMP_Enqueue_ordered(
     
    615606  Scheduler_SMP_Move                  move_from_scheduled_to_ready,
    616607  Scheduler_SMP_Get_lowest_scheduled  get_lowest_scheduled,
    617   Scheduler_SMP_Allocate_processor    allocate_processor,
    618   Scheduler_Release_idle_thread       release_idle_thread
     608  Scheduler_SMP_Allocate_processor    allocate_processor
    619609)
    620610{
     
    629619      insert_scheduled,
    630620      move_from_scheduled_to_ready,
    631       allocate_processor,
    632       release_idle_thread
     621      allocate_processor
    633622    );
    634623  } else {
     
    657646 * @param[in] allocate_processor Function to allocate a processor to a node
    658647 *   based on the rules of the scheduler.
    659  * @param[in] get_idle_thread Function to get an idle thread.
    660  * @param[in] release_idle_thread Function to release an idle thread.
    661648 */
    662649static inline Thread_Control *_Scheduler_SMP_Enqueue_scheduled_ordered(
     
    669656  Scheduler_SMP_Insert              insert_scheduled,
    670657  Scheduler_SMP_Move                move_from_ready_to_scheduled,
    671   Scheduler_SMP_Allocate_processor  allocate_processor,
    672   Scheduler_Get_idle_thread         get_idle_thread,
    673   Scheduler_Release_idle_thread     release_idle_thread
     658  Scheduler_SMP_Allocate_processor  allocate_processor
    674659)
    675660{
     
    693678        context,
    694679        highest_ready,
    695         get_idle_thread
     680        _Scheduler_SMP_Get_idle_thread
    696681      )
    697682    ) {
     
    718703        context,
    719704        node,
    720         release_idle_thread
     705        _Scheduler_SMP_Release_idle_thread
    721706      );
    722707      if ( idle == NULL ) {
     
    753738  Scheduler_SMP_Get_highest_ready   get_highest_ready,
    754739  Scheduler_SMP_Move                move_from_ready_to_scheduled,
    755   Scheduler_SMP_Allocate_processor  allocate_processor,
    756   Scheduler_Get_idle_thread         get_idle_thread
     740  Scheduler_SMP_Allocate_processor  allocate_processor
    757741)
    758742{
     
    764748        context,
    765749        highest_ready,
    766         get_idle_thread
     750        _Scheduler_SMP_Get_idle_thread
    767751      )
    768752    ) {
     
    798782 * @param[in] move_from_ready_to_scheduled Function to move a node from the set
    799783 *   of ready nodes to the set of scheduled nodes.
    800  * @param[in] get_idle_thread Function to get an idle thread.
    801784 */
    802785static inline void _Scheduler_SMP_Block(
     
    806789  Scheduler_SMP_Get_highest_ready   get_highest_ready,
    807790  Scheduler_SMP_Move                move_from_ready_to_scheduled,
    808   Scheduler_SMP_Allocate_processor  allocate_processor,
    809   Scheduler_Get_idle_thread         get_idle_thread
     791  Scheduler_SMP_Allocate_processor  allocate_processor
    810792)
    811793{
     
    816798    &node->Base,
    817799    is_scheduled,
    818     get_idle_thread
     800    _Scheduler_SMP_Get_idle_thread
    819801  );
    820802
     
    831813        get_highest_ready,
    832814        move_from_ready_to_scheduled,
    833         allocate_processor,
    834         get_idle_thread
     815        allocate_processor
    835816      );
    836817    } else {
     
    843824  Scheduler_Context             *context,
    844825  Thread_Control                *thread,
    845   Scheduler_SMP_Enqueue          enqueue_fifo,
    846   Scheduler_Release_idle_thread  release_idle_thread
     826  Scheduler_SMP_Enqueue          enqueue_fifo
    847827)
    848828{
     
    854834    &node->Base,
    855835    is_scheduled,
    856     release_idle_thread
     836    _Scheduler_SMP_Release_idle_thread
    857837  );
    858838  Thread_Control *needs_help;
     
    918898  Thread_Control                     *offers_help,
    919899  Thread_Control                     *needs_help,
    920   Scheduler_SMP_Enqueue               enqueue_fifo,
    921   Scheduler_Release_idle_thread       release_idle_thread
     900  Scheduler_SMP_Enqueue               enqueue_fifo
    922901)
    923902{
     
    941920        needs_help,
    942921        previous_accepts_help,
    943         release_idle_thread
     922        _Scheduler_SMP_Release_idle_thread
    944923      );
    945924      break;
Note: See TracChangeset for help on using the changeset viewer.