Changeset 21bdca4 in rtems


Ignore:
Timestamp:
Aug 3, 2016, 1:41:31 PM (3 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
1c1e31f7
Parents:
ff2e6c64
git-author:
Sebastian Huber <sebastian.huber@…> (08/03/16 13:41:31)
git-committer:
Sebastian Huber <sebastian.huber@…> (08/04/16 05:44:47)
Message:

score: Indroduce cancel job scheduler operation

Do not use a deadline value of zero to indicate a job cancellation. Use
a dedicated scheduler operation for this.

Location:
cpukit
Files:
13 edited

Legend:

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

    rff2e6c64 r21bdca4  
    3939  _Rate_monotonic_Release( owner, lock_context );
    4040
    41   _Scheduler_Release_job( owner, 0 );
     41  _Scheduler_Cancel_job( owner );
    4242
    4343  _Thread_Dispatch_enable( cpu_self );
  • cpukit/score/include/rtems/score/scheduler.h

    rff2e6c64 r21bdca4  
    144144    Thread_Control *,
    145145    uint64_t
     146  );
     147
     148  /** @see _Scheduler_Cancel_job() */
     149  void ( *cancel_job ) (
     150    const Scheduler_Control *,
     151    Thread_Control *
    146152  );
    147153
     
    536542
    537543/**
     544 * @brief Does nothing.
     545 *
     546 * @param[in] scheduler Unused.
     547 * @param[in] the_thread Unused.
     548 */
     549void _Scheduler_default_Cancel_job(
     550  const Scheduler_Control *scheduler,
     551  Thread_Control          *the_thread
     552);
     553
     554/**
    538555 * @brief Performs tick operations depending on the CPU budget algorithm for
    539556 * each executing thread.
  • cpukit/score/include/rtems/score/schedulercbs.h

    rff2e6c64 r21bdca4  
    6262    _Scheduler_default_Node_destroy, /* node destroy entry point */ \
    6363    _Scheduler_CBS_Release_job,      /* new period of task */ \
     64    _Scheduler_EDF_Cancel_job,       /* cancel period of task */ \
    6465    _Scheduler_default_Tick,         /* tick entry point */ \
    6566    _Scheduler_default_Start_idle    /* start idle entry point */ \
  • cpukit/score/include/rtems/score/scheduleredf.h

    rff2e6c64 r21bdca4  
    6262    _Scheduler_default_Node_destroy, /* node destroy entry point */ \
    6363    _Scheduler_EDF_Release_job,      /* new period of task */ \
     64    _Scheduler_EDF_Cancel_job,       /* cancel period of task */ \
    6465    _Scheduler_default_Tick,         /* tick entry point */ \
    6566    _Scheduler_default_Start_idle    /* start idle entry point */ \
     
    228229 *             has to be suspended.
    229230 */
    230 void _Scheduler_EDF_Release_job (
     231void _Scheduler_EDF_Release_job(
    231232  const Scheduler_Control *scheduler,
    232233  Thread_Control          *the_thread,
    233234  uint64_t                 deadline
     235);
     236
     237void _Scheduler_EDF_Cancel_job(
     238  const Scheduler_Control *scheduler,
     239  Thread_Control          *the_thread
    234240);
    235241
  • cpukit/score/include/rtems/score/schedulerimpl.h

    rff2e6c64 r21bdca4  
    506506
    507507  ( *scheduler->Operations.release_job )( scheduler, the_thread, deadline );
     508}
     509
     510/**
     511 * @brief Cancels a job of a thread with respect to the scheduler.
     512 *
     513 * @param[in] the_thread The thread.
     514 */
     515RTEMS_INLINE_ROUTINE void _Scheduler_Cancel_job(
     516  Thread_Control *the_thread
     517)
     518{
     519  const Scheduler_Control *scheduler = _Scheduler_Get( the_thread );
     520
     521  ( *scheduler->Operations.cancel_job )( scheduler, the_thread );
    508522}
    509523
  • cpukit/score/include/rtems/score/schedulerpriority.h

    rff2e6c64 r21bdca4  
    5252    _Scheduler_default_Node_destroy,      /* node destroy entry point */ \
    5353    _Scheduler_default_Release_job,       /* new period of task */ \
     54    _Scheduler_default_Cancel_job,        /* cancel period of task */ \
    5455    _Scheduler_default_Tick,              /* tick entry point */ \
    5556    _Scheduler_default_Start_idle         /* start idle entry point */ \
  • cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h

    rff2e6c64 r21bdca4  
    6262    _Scheduler_default_Node_destroy, \
    6363    _Scheduler_default_Release_job, \
     64    _Scheduler_default_Cancel_job, \
    6465    _Scheduler_default_Tick, \
    6566    _Scheduler_SMP_Start_idle, \
  • cpukit/score/include/rtems/score/schedulerprioritysmp.h

    rff2e6c64 r21bdca4  
    9191    _Scheduler_default_Node_destroy, \
    9292    _Scheduler_default_Release_job, \
     93    _Scheduler_default_Cancel_job, \
    9394    _Scheduler_default_Tick, \
    9495    _Scheduler_SMP_Start_idle \
  • cpukit/score/include/rtems/score/schedulersimple.h

    rff2e6c64 r21bdca4  
    5252    _Scheduler_default_Node_destroy,      /* node destroy entry point */ \
    5353    _Scheduler_default_Release_job,       /* new period of task */ \
     54    _Scheduler_default_Cancel_job,        /* cancel period of task */ \
    5455    _Scheduler_default_Tick,              /* tick entry point */ \
    5556    _Scheduler_default_Start_idle         /* start idle entry point */ \
  • cpukit/score/include/rtems/score/schedulersimplesmp.h

    rff2e6c64 r21bdca4  
    7474    _Scheduler_default_Node_destroy, \
    7575    _Scheduler_default_Release_job, \
     76    _Scheduler_default_Cancel_job, \
    7677    _Scheduler_default_Tick, \
    7778    _Scheduler_SMP_Start_idle \
  • cpukit/score/include/rtems/score/schedulerstrongapa.h

    rff2e6c64 r21bdca4  
    9191    _Scheduler_default_Node_destroy, \
    9292    _Scheduler_default_Release_job, \
     93    _Scheduler_default_Cancel_job, \
    9394    _Scheduler_default_Tick, \
    9495    _Scheduler_SMP_Start_idle \
  • cpukit/score/src/schedulerdefaultreleasejob.c

    rff2e6c64 r21bdca4  
    3232  (void) deadline;
    3333}
     34
     35void _Scheduler_default_Cancel_job(
     36  const Scheduler_Control *scheduler,
     37  Thread_Control          *the_thread
     38)
     39{
     40  (void) scheduler;
     41  (void) the_thread;
     42}
  • cpukit/score/src/scheduleredfreleasejob.c

    rff2e6c64 r21bdca4  
    2121#include <rtems/score/scheduleredfimpl.h>
    2222
    23 static bool _Scheduler_EDF_Priority_filter(
     23static bool _Scheduler_EDF_Release_job_filter(
    2424  Thread_Control   *the_thread,
    2525  Priority_Control *new_priority_p,
     
    3535  current_priority = the_thread->current_priority;
    3636  new_priority = *new_priority_p;
    37 
    38   if ( new_priority == 0 ) {
    39     new_priority = node->background_priority;
    40   }
    4137
    4238  node->current_priority = new_priority;
     
    5551  _Thread_Change_priority(
    5652    the_thread,
    57     (Priority_Control) deadline,
     53    deadline,
    5854    NULL,
    59     _Scheduler_EDF_Priority_filter,
     55    _Scheduler_EDF_Release_job_filter,
    6056    true
    6157  );
    6258}
     59
     60static bool _Scheduler_EDF_Cancel_job_filter(
     61  Thread_Control   *the_thread,
     62  Priority_Control *new_priority_p,
     63  void             *arg
     64)
     65{
     66  Scheduler_EDF_Node *node;
     67  Priority_Control    current_priority;
     68  Priority_Control    new_priority;
     69
     70  node = _Scheduler_EDF_Thread_get_node( the_thread );
     71
     72  current_priority = _Thread_Get_priority( the_thread );
     73  new_priority = node->background_priority;
     74
     75  node->current_priority = new_priority;
     76  the_thread->real_priority = new_priority;
     77
     78  return _Thread_Priority_less_than( current_priority, new_priority )
     79    || !_Thread_Owns_resources( the_thread );
     80}
     81
     82void _Scheduler_EDF_Cancel_job(
     83  const Scheduler_Control *scheduler,
     84  Thread_Control          *the_thread
     85)
     86{
     87  _Thread_Change_priority(
     88    the_thread,
     89    0,
     90    NULL,
     91    _Scheduler_EDF_Cancel_job_filter,
     92    true
     93  );
     94}
Note: See TracChangeset for help on using the changeset viewer.