Changeset e0a9336b in rtems


Ignore:
Timestamp:
Sep 3, 2018, 6:12:35 AM (8 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
ccdce9d8
Parents:
3aad9d9b
git-author:
Sebastian Huber <sebastian.huber@…> (09/03/18 06:12:35)
git-committer:
Sebastian Huber <sebastian.huber@…> (09/03/18 07:37:35)
Message:

score: Fix EDF SMP scheduler

Fix a special case: block a one-to-one scheduled thread while having a
non-empty affine ready queue on the same processor.

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • cpukit/score/src/scheduleredfsmp.c

    r3aad9d9b re0a9336b  
    274274      _Chain_Append_unprotected( &self->Affine_queues, &ready_queue->Node );
    275275    }
     276  }
     277}
     278
     279static inline void _Scheduler_EDF_SMP_Extract_from_scheduled(
     280  Scheduler_Context *context,
     281  Scheduler_Node    *node_to_extract
     282)
     283{
     284  Scheduler_EDF_SMP_Context     *self;
     285  Scheduler_EDF_SMP_Node        *node;
     286  uint8_t                        rqi;
     287  Scheduler_EDF_SMP_Ready_queue *ready_queue;
     288
     289  self = _Scheduler_EDF_SMP_Get_self( context );
     290  node = _Scheduler_EDF_SMP_Node_downcast( node_to_extract );
     291
     292  _Scheduler_SMP_Extract_from_scheduled( &self->Base.Base, &node->Base.Base );
     293
     294  rqi = node->ready_queue_index;
     295  ready_queue = &self->Ready[ rqi ];
     296
     297  if ( rqi != 0 && !_RBTree_Is_empty( &ready_queue->Queue ) ) {
     298    _Chain_Append_unprotected( &self->Affine_queues, &ready_queue->Node );
    276299  }
    277300}
     
    404427    thread,
    405428    node,
    406     _Scheduler_SMP_Extract_from_scheduled,
     429    _Scheduler_EDF_SMP_Extract_from_scheduled,
    407430    _Scheduler_EDF_SMP_Extract_from_ready,
    408431    _Scheduler_EDF_SMP_Get_highest_ready,
  • testsuites/smptests/smpschededf02/init.c

    r3aad9d9b re0a9336b  
    157157  SET_AFFINITY( 1,  A(1, 0),    0, IDLE),
    158158  UNBLOCK(      1,              1,    0),
     159  /*
     160   * Block a one-to-one thread while having a non-empty affine ready queue on
     161   * the same processor.
     162   */
     163  RESET,
     164  SET_AFFINITY( 1,  A(1, 0), IDLE, IDLE),
     165  SET_AFFINITY( 3,  A(1, 0), IDLE, IDLE),
     166  UNBLOCK(      0,              0, IDLE),
     167  UNBLOCK(      1,              1,    0),
     168  UNBLOCK(      2,              1,    0),
     169  UNBLOCK(      3,              1,    0),
     170  BLOCK(        1,              2,    0),
     171  BLOCK(        0,              3,    2),
     172  /*
     173   * Make sure that a one-to-one thread does not get the wrong processor
     174   * allocated after selecting the highest ready thread.
     175   */
     176  RESET,
     177  SET_AFFINITY( 1,  A(1, 0), IDLE, IDLE),
     178  SET_AFFINITY( 2,  A(1, 0), IDLE, IDLE),
     179  UNBLOCK(      0,              0, IDLE),
     180  UNBLOCK(      1,              1,    0),
     181  UNBLOCK(      2,              1,    0),
     182  BLOCK(        0,              1, IDLE),
    159183  RESET
    160184};
Note: See TracChangeset for help on using the changeset viewer.