Changeset 92635cb in rtems


Ignore:
Timestamp:
Jun 3, 2014, 2:27:53 PM (5 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
2d36931
Parents:
bd1431a
git-author:
Sebastian Huber <sebastian.huber@…> (06/03/14 14:27:53)
git-committer:
Sebastian Huber <sebastian.huber@…> (06/23/14 07:13:00)
Message:

score: Remove scheduler parameter from most ops

Remove the scheduler parameter from most high level scheduler operations
like

  • _Scheduler_Block(),
  • _Scheduler_Unblock(),
  • _Scheduler_Change_priority(),
  • _Scheduler_Update_priority(),
  • _Scheduler_Release_job(), and
  • _Scheduler_Yield().

This simplifies the scheduler operations usage.

Location:
cpukit
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • cpukit/rtems/src/ratemoncancel.c

    rbd1431a r92635cb  
    4141      (void) _Watchdog_Remove( &the_period->Timer );
    4242      the_period->state = RATE_MONOTONIC_INACTIVE;
    43       _Scheduler_Release_job(
    44         _Scheduler_Get( the_period->owner ),
    45         the_period->owner,
    46         0
    47       );
     43      _Scheduler_Release_job( the_period->owner, 0 );
    4844      _Objects_Put( &the_period->Object );
    4945      return RTEMS_SUCCESSFUL;
  • cpukit/rtems/src/ratemondelete.c

    rbd1431a r92635cb  
    3636
    3737    case OBJECTS_LOCAL:
    38       _Scheduler_Release_job(
    39         _Scheduler_Get( the_period->owner ),
    40         the_period->owner,
    41         0
    42       );
     38      _Scheduler_Release_job( the_period->owner, 0 );
    4339      _Objects_Close( &_Rate_monotonic_Information, &the_period->Object );
    4440      (void) _Watchdog_Remove( &the_period->Timer );
  • cpukit/rtems/src/ratemonperiod.c

    rbd1431a r92635cb  
    145145  #endif
    146146
    147   _Scheduler_Release_job(
    148     _Scheduler_Get( the_period->owner ),
    149     the_period->owner,
    150     the_period->next_length
    151   );
     147  _Scheduler_Release_job( the_period->owner, the_period->next_length );
    152148}
    153149
     
    345341
    346342        _Watchdog_Insert_ticks( &the_period->Timer, length );
    347         _Scheduler_Release_job(
    348           _Scheduler_Get( the_period->owner ),
    349           the_period->owner,
    350           the_period->next_length
    351         );
     343        _Scheduler_Release_job( the_period->owner, the_period->next_length );
    352344        _Objects_Put( &the_period->Object );
    353345        return RTEMS_TIMEOUT;
  • cpukit/score/include/rtems/score/schedulerimpl.h

    rbd1431a r92635cb  
    4242 */
    4343void _Scheduler_Handler_initialization( void );
     44
     45RTEMS_INLINE_ROUTINE const Scheduler_Control *_Scheduler_Get(
     46  const Thread_Control *the_thread
     47)
     48{
     49#if defined(RTEMS_SMP)
     50  return the_thread->scheduler;
     51#else
     52  (void) the_thread;
     53
     54  return &_Scheduler_Table[ 0 ];
     55#endif
     56}
    4457
    4558RTEMS_INLINE_ROUTINE const Scheduler_Control *_Scheduler_Get_by_CPU_index(
     
    8194
    8295/**
    83  * @brief Scheduler schedule.
     96 * @brief General scheduling decision.
    8497 *
    8598 * This kernel routine implements the scheduling decision logic for
     
    88101 * @param[in] the_thread The thread which state changed previously.
    89102 */
    90 RTEMS_INLINE_ROUTINE void _Scheduler_Schedule(
    91   const Scheduler_Control *scheduler,
    92   Thread_Control          *the_thread
    93 )
    94 {
     103RTEMS_INLINE_ROUTINE void _Scheduler_Schedule( Thread_Control *the_thread )
     104{
     105  const Scheduler_Control *scheduler = _Scheduler_Get( the_thread );
     106
    95107  ( *scheduler->Operations.schedule )( scheduler, the_thread );
    96108}
     
    104116 * @param[in] the_thread The yielding thread.
    105117 */
    106 RTEMS_INLINE_ROUTINE void _Scheduler_Yield(
    107   const Scheduler_Control *scheduler,
    108   Thread_Control          *the_thread
    109 )
    110 {
     118RTEMS_INLINE_ROUTINE void _Scheduler_Yield( Thread_Control *the_thread )
     119{
     120  const Scheduler_Control *scheduler = _Scheduler_Get( the_thread );
     121
    111122  ( *scheduler->Operations.yield )( scheduler, the_thread );
    112123}
    113124
    114125/**
    115  * @brief Scheduler block.
     126 * @brief Blocks a thread with respect to the scheduler.
    116127 *
    117128 * This routine removes @a the_thread from the scheduling decision for
     
    119130 * ready queue.  It performs any necessary schedulering operations
    120131 * including the selection of a new heir thread.
    121  */
    122 RTEMS_INLINE_ROUTINE void _Scheduler_Block(
    123   const Scheduler_Control *scheduler,
    124   Thread_Control               *the_thread
    125 )
    126 {
     132 *
     133 * @param[in] the_thread The thread.
     134 */
     135RTEMS_INLINE_ROUTINE void _Scheduler_Block( Thread_Control *the_thread )
     136{
     137  const Scheduler_Control *scheduler = _Scheduler_Get( the_thread );
     138
    127139  ( *scheduler->Operations.block )( scheduler, the_thread );
    128140}
    129141
    130142/**
    131  * @brief Scheduler unblock.
     143 * @brief Unblocks a thread with respect to the scheduler.
    132144 *
    133145 * This routine adds @a the_thread to the scheduling decision for
     
    135147 * ready queue per the schedulering policy and update any appropriate
    136148 * scheduling variables, for example the heir thread.
    137  */
    138 RTEMS_INLINE_ROUTINE void _Scheduler_Unblock(
    139   const Scheduler_Control *scheduler,
    140   Thread_Control          *the_thread
    141 )
    142 {
     149 *
     150 * @param[in] the_thread The thread.
     151 */
     152RTEMS_INLINE_ROUTINE void _Scheduler_Unblock( Thread_Control *the_thread )
     153{
     154  const Scheduler_Control *scheduler = _Scheduler_Get( the_thread );
     155
    143156  ( *scheduler->Operations.unblock )( scheduler, the_thread );
    144157}
     
    151164 * current priority value.
    152165 *
    153  * @param[in] scheduler The scheduler instance.
    154166 * @param[in] the_thread The thread changing its priority.
    155167 * @param[in] new_priority The new thread priority.
     
    159171 */
    160172RTEMS_INLINE_ROUTINE void _Scheduler_Change_priority(
    161   const Scheduler_Control *scheduler,
    162173  Thread_Control          *the_thread,
    163174  Priority_Control         new_priority,
     
    165176)
    166177{
     178  const Scheduler_Control *scheduler = _Scheduler_Get( the_thread );
     179
    167180  ( *scheduler->Operations.change_priority )(
    168181    scheduler,
     
    216229 */
    217230RTEMS_INLINE_ROUTINE void _Scheduler_Update_priority(
    218   const Scheduler_Control *scheduler,
    219   Thread_Control          *the_thread,
    220   Priority_Control         new_priority
    221 )
    222 {
     231  Thread_Control   *the_thread,
     232  Priority_Control  new_priority
     233)
     234{
     235  const Scheduler_Control *scheduler = _Scheduler_Get( the_thread );
     236
    223237  ( *scheduler->Operations.update_priority )(
    224238    scheduler,
     
    254268
    255269/**
    256  * @brief Scheduler release job.
    257  *
    258  * This routine is called when a new period of task is issued.
     270 * @brief Releases a job of a thread with respect to the scheduler.
     271 *
     272 * @param[in] the_thread The thread.
     273 * @param[in] length The period length.
    259274 */
    260275RTEMS_INLINE_ROUTINE void _Scheduler_Release_job(
    261   const Scheduler_Control *scheduler,
    262   Thread_Control          *the_thread,
    263   uint32_t                 length
    264 )
    265 {
     276  Thread_Control *the_thread,
     277  uint32_t        length
     278)
     279{
     280  const Scheduler_Control *scheduler = _Scheduler_Get( the_thread );
     281
    266282  ( *scheduler->Operations.release_job )( scheduler, the_thread, length );
    267283}
     
    346362
    347363  return true;
    348 #endif
    349 }
    350 
    351 RTEMS_INLINE_ROUTINE const Scheduler_Control *_Scheduler_Get(
    352   const Thread_Control *the_thread
    353 )
    354 {
    355 #if defined(RTEMS_SMP)
    356   return the_thread->scheduler;
    357 #else
    358   (void) the_thread;
    359 
    360   return &_Scheduler_Table[ 0 ];
    361364#endif
    362365}
     
    375378    the_thread->scheduler = scheduler;
    376379    _Scheduler_Node_initialize( scheduler, the_thread );
    377     _Scheduler_Update_priority(
    378       scheduler,
    379       the_thread,
    380       the_thread->current_priority
    381     );
     380    _Scheduler_Update_priority( the_thread, the_thread->current_priority );
    382381    _Thread_Clear_state( the_thread, STATES_MIGRATING );
    383382  }
  • cpukit/score/src/schedulerdefaultstartidle.c

    rbd1431a r92635cb  
    1919)
    2020{
     21  (void) scheduler;
    2122  (void) cpu;
    22   _Scheduler_Unblock( scheduler, the_thread );
     23  _Scheduler_Unblock( the_thread );
    2324}
  • cpukit/score/src/threadchangepriority.c

    rbd1431a r92635cb  
    8282   */
    8383  if ( the_thread->current_priority != new_priority ) {
    84     ISR_Level                level;
    85     const Scheduler_Control *scheduler;
     84    ISR_Level level;
    8685
    8786    _ISR_Disable( level );
    8887
    89     scheduler = _Scheduler_Get( the_thread );
    9088    the_thread->current_priority = new_priority;
    9189
    9290    if ( _States_Is_ready( the_thread->current_state ) ) {
    9391      _Scheduler_Change_priority(
    94         scheduler,
    9592        the_thread,
    9693        new_priority,
     
    104101       *  who is the heir and if we need to switch to them.
    105102       */
    106       scheduler = _Scheduler_Get( the_thread );
    107       _Scheduler_Schedule( scheduler, the_thread );
     103      _Scheduler_Schedule( the_thread );
    108104    } else {
    109       _Scheduler_Update_priority( scheduler, the_thread, new_priority );
     105      _Scheduler_Update_priority( the_thread, new_priority );
    110106    }
    111107    _ISR_Enable( level );
  • cpukit/score/src/threadclearstate.c

    rbd1431a r92635cb  
    3838
    3939      if ( _States_Is_ready( current_state ) ) {
    40         _Scheduler_Unblock( _Scheduler_Get( the_thread ), the_thread );
     40        _Scheduler_Unblock( the_thread );
    4141      }
    4242  }
  • cpukit/score/src/threadready.c

    rbd1431a r92635cb  
    3333  the_thread->current_state = STATES_READY;
    3434
    35   _Scheduler_Unblock( _Scheduler_Get( the_thread ), the_thread );
     35  _Scheduler_Unblock( the_thread );
    3636
    3737  _ISR_Enable( level );
  • cpukit/score/src/threadsetpriority.c

    rbd1431a r92635cb  
    2929  the_thread->current_priority = new_priority;
    3030
    31   _Scheduler_Update_priority(
    32     _Scheduler_Get( the_thread),
    33     the_thread,
    34     new_priority
    35   );
     31  _Scheduler_Update_priority( the_thread, new_priority );
    3632}
  • cpukit/score/src/threadsetstate.c

    rbd1431a r92635cb  
    4040    the_thread->current_state = state;
    4141
    42     _Scheduler_Block( _Scheduler_Get( the_thread ), the_thread );
     42    _Scheduler_Block( the_thread );
    4343  } else {
    4444    the_thread->current_state = _States_Set( state, current_state);
  • cpukit/score/src/threadyield.c

    rbd1431a r92635cb  
    3535
    3636  if ( _States_Is_ready( executing->current_state ) ) {
    37     _Scheduler_Yield( _Scheduler_Get( executing ), executing );
     37    _Scheduler_Yield( executing );
    3838  }
    3939
Note: See TracChangeset for help on using the changeset viewer.