[PATCH v2] score: Replace priority prepend it with an enum

Chris Johns chrisj at rtems.org
Fri Aug 13 02:44:35 UTC 2021


+1

On 13/8/21 3:43 am, Gedare Bloom wrote:
> looks good to me.
> 
> On Thu, Aug 12, 2021 at 8:26 AM Sebastian Huber
> <sebastian.huber at embedded-brains.de> wrote:
>>
>> Use the new Priority_Group_order enum instead of a boolean to indicated if a
>> priority should be inserted as the first or last node into its priority group.
>> This makes the code more expressive.  It is also a bit more efficient since a
>> branch in _Scheduler_Node_set_priority() is avoided and a simple bitwise or
>> operation can be used.
>> ---
>> v2:
>>
>> Rename Priority_Flags in Priority_Group_order.
>>
>>  cpukit/include/rtems/posix/muteximpl.h        |  2 +-
>>  cpukit/include/rtems/score/coremuteximpl.h    |  2 +-
>>  cpukit/include/rtems/score/priorityimpl.h     | 44 ++++++++++++++-----
>>  cpukit/include/rtems/score/schedulerimpl.h    | 12 ++++-
>>  .../include/rtems/score/schedulernodeimpl.h   | 30 ++++++-------
>>  cpukit/include/rtems/score/threadimpl.h       | 20 +++++----
>>  cpukit/posix/src/pthreadsetschedparam.c       |  2 +-
>>  cpukit/posix/src/pthreadsetschedprio.c        |  2 +-
>>  cpukit/rtems/src/tasksetpriority.c            |  2 +-
>>  cpukit/score/src/scheduleredfreleasejob.c     |  2 +-
>>  cpukit/score/src/threadchangepriority.c       | 39 +++++++++-------
>>  cpukit/score/src/threadqops.c                 | 18 ++++----
>>  cpukit/score/src/threadrestart.c              |  4 +-
>>  testsuites/smptests/smpscheduler03/test.c     | 33 +++++++-------
>>  14 files changed, 126 insertions(+), 86 deletions(-)
>>
>> diff --git a/cpukit/include/rtems/posix/muteximpl.h b/cpukit/include/rtems/posix/muteximpl.h
>> index 435b43634d..5d20bc1ef6 100644
>> --- a/cpukit/include/rtems/posix/muteximpl.h
>> +++ b/cpukit/include/rtems/posix/muteximpl.h
>> @@ -273,7 +273,7 @@ RTEMS_INLINE_ROUTINE void _POSIX_Mutex_Set_priority(
>>        owner,
>>        &the_mutex->Priority_ceiling,
>>        priority_ceiling,
>> -      false,
>> +      PRIORITY_GROUP_LAST,
>>        queue_context
>>      );
>>      _Thread_Wait_release( owner, queue_context );
>> diff --git a/cpukit/include/rtems/score/coremuteximpl.h b/cpukit/include/rtems/score/coremuteximpl.h
>> index cbc1e720fb..426c4c5a95 100644
>> --- a/cpukit/include/rtems/score/coremuteximpl.h
>> +++ b/cpukit/include/rtems/score/coremuteximpl.h
>> @@ -375,7 +375,7 @@ RTEMS_INLINE_ROUTINE void _CORE_ceiling_mutex_Set_priority(
>>        owner,
>>        &the_mutex->Priority_ceiling,
>>        priority_ceiling,
>> -      false,
>> +      PRIORITY_GROUP_LAST,
>>        queue_context
>>      );
>>      _Thread_Wait_release( owner, queue_context );
>> diff --git a/cpukit/include/rtems/score/priorityimpl.h b/cpukit/include/rtems/score/priorityimpl.h
>> index 7a14ec97b8..2895a0c4a5 100644
>> --- a/cpukit/include/rtems/score/priorityimpl.h
>> +++ b/cpukit/include/rtems/score/priorityimpl.h
>> @@ -37,6 +37,29 @@ extern "C" {
>>   * @{
>>   */
>>
>> + /**
>> +  * @brief The priority group order determines if a priority node is inserted
>> +  *   as the first or last node into its priority group.
>> +  *
>> +  * The values of the enumerators matter.  The least significant bit of a
>> +  * ::Priority_Control value is not used for the actual priority of a node.
>> +  * During insertion the least significant bit is used to determine the
>> +  * ordering within a priority group based on the enumerator values.
>> +  */
>> +typedef enum {
>> +  /**
>> +   * @brief Priority group first option requests that the priority node is
>> +   *   inserted as the first node into its priority group.
>> +   */
>> +  PRIORITY_GROUP_FIRST = 0,
>> +
>> +  /**
>> +   * @brief Priority group last option requests that the priority node is
>> +   *   inserted as the last node into its priority group.
>> +   */
>> +  PRIORITY_GROUP_LAST = 1
>> +} Priority_Group_order;
>> +
>>  /**
>>   * @brief Initializes the priority actions empty.
>>   *
>> @@ -465,7 +488,7 @@ typedef void ( *Priority_Add_handler )(
>>
>>  typedef void ( *Priority_Change_handler )(
>>    Priority_Aggregation *aggregation,
>> -  bool                  prepend_it,
>> +  Priority_Group_order  group_order,
>>    Priority_Actions     *actions,
>>    void                 *arg
>>  );
>> @@ -482,19 +505,19 @@ typedef void ( *Priority_Remove_handler )(
>>   * This method does nothing.
>>   *
>>   * @param aggregation Is ignored by the method.
>> - * @param prepend_it Is ignored by the method.
>> + * @param group_order Is ignored by the method.
>>   * @param actions Is ignored by the method.
>>   * @param arg Is ignored by the method.
>>   */
>>  RTEMS_INLINE_ROUTINE void _Priority_Change_nothing(
>>    Priority_Aggregation *aggregation,
>> -  bool                  prepend_it,
>> +  Priority_Group_order  group_order,
>>    Priority_Actions     *actions,
>>    void                 *arg
>>  )
>>  {
>>    (void) aggregation;
>> -  (void) prepend_it;
>> +  (void) group_order;
>>    (void) actions;
>>    (void) arg;
>>  }
>> @@ -547,7 +570,7 @@ RTEMS_INLINE_ROUTINE void _Priority_Non_empty_insert(
>>
>>    if ( is_new_minimum ) {
>>      aggregation->Node.priority = node->priority;
>> -    ( *change )( aggregation, false, actions, arg );
>> +    ( *change )( aggregation, PRIORITY_GROUP_LAST, actions, arg );
>>    }
>>  }
>>
>> @@ -619,7 +642,7 @@ RTEMS_INLINE_ROUTINE void _Priority_Extract(
>>
>>      if ( node->priority < min->priority ) {
>>        aggregation->Node.priority = min->priority;
>> -      ( *change )( aggregation, true, actions, arg );
>> +      ( *change )( aggregation, PRIORITY_GROUP_FIRST, actions, arg );
>>      }
>>    }
>>  }
>> @@ -654,7 +677,7 @@ RTEMS_INLINE_ROUTINE void _Priority_Extract_non_empty(
>>
>>    if ( node->priority < min->priority ) {
>>      aggregation->Node.priority = min->priority;
>> -    ( *change )( aggregation, true, actions, arg );
>> +    ( *change )( aggregation, PRIORITY_GROUP_FIRST, actions, arg );
>>    }
>>  }
>>
>> @@ -666,8 +689,7 @@ RTEMS_INLINE_ROUTINE void _Priority_Extract_non_empty(
>>   *
>>   * @param[in, out] aggregation The aggregation to change the node in.
>>   * @param node The node that has a new priority and will be reinserted in the aggregation.
>> - * @param prepend_it Indicates whether @a change should prepend if the minimal priority is
>> - *      incorrectly set after the change.
>> + * @param group_order The priority group order which may be used by @ change.
>>   * @param actions The actions for the case that the minimal priority is incorrectly set
>>   *      after the change.
>>   * @param change Is called if the minimal priority is incorrectly set after the change.
>> @@ -676,7 +698,7 @@ RTEMS_INLINE_ROUTINE void _Priority_Extract_non_empty(
>>  RTEMS_INLINE_ROUTINE void _Priority_Changed(
>>    Priority_Aggregation    *aggregation,
>>    Priority_Node           *node,
>> -  bool                     prepend_it,
>> +  Priority_Group_order     group_order,
>>    Priority_Actions        *actions,
>>    Priority_Change_handler  change,
>>    void                    *arg
>> @@ -695,7 +717,7 @@ RTEMS_INLINE_ROUTINE void _Priority_Changed(
>>
>>    if ( min->priority != aggregation->Node.priority ) {
>>      aggregation->Node.priority = min->priority;
>> -    ( *change )( aggregation, prepend_it, actions, arg );
>> +    ( *change )( aggregation, group_order, actions, arg );
>>    }
>>  }
>>
>> diff --git a/cpukit/include/rtems/score/schedulerimpl.h b/cpukit/include/rtems/score/schedulerimpl.h
>> index 595d6291b4..24db4d7818 100644
>> --- a/cpukit/include/rtems/score/schedulerimpl.h
>> +++ b/cpukit/include/rtems/score/schedulerimpl.h
>> @@ -1388,7 +1388,11 @@ RTEMS_INLINE_ROUTINE Status_Control _Scheduler_Set(
>>        &new_scheduler_node->Thread.Scheduler_node.Chain
>>      );
>>
>> -    _Scheduler_Node_set_priority( new_scheduler_node, priority, false );
>> +    _Scheduler_Node_set_priority(
>> +      new_scheduler_node,
>> +      priority,
>> +      PRIORITY_GROUP_LAST
>> +    );
>>
>>      if ( _States_Is_ready( current_state ) ) {
>>        _Scheduler_Unblock( the_thread );
>> @@ -1398,7 +1402,11 @@ RTEMS_INLINE_ROUTINE Status_Control _Scheduler_Set(
>>    }
>>  #endif
>>
>> -  _Scheduler_Node_set_priority( new_scheduler_node, priority, false );
>> +  _Scheduler_Node_set_priority(
>> +    new_scheduler_node,
>> +    priority,
>> +    PRIORITY_GROUP_LAST
>> +  );
>>    _Scheduler_Update_priority( the_thread );
>>    return STATUS_SUCCESSFUL;
>>  }
>> diff --git a/cpukit/include/rtems/score/schedulernodeimpl.h b/cpukit/include/rtems/score/schedulernodeimpl.h
>> index 5d6f795912..9b5c632d86 100644
>> --- a/cpukit/include/rtems/score/schedulernodeimpl.h
>> +++ b/cpukit/include/rtems/score/schedulernodeimpl.h
>> @@ -46,12 +46,6 @@ extern "C" {
>>  #define SCHEDULER_NODE_OF_WAIT_PRIORITY( node ) \
>>    RTEMS_CONTAINER_OF( node, Scheduler_Node, Wait.Priority )
>>
>> -/**
>> - * @brief Priority append indicator for the priority control used for the
>> - * scheduler node priority.
>> - */
>> -#define SCHEDULER_PRIORITY_APPEND_FLAG 1
>> -
>>  /**
>>   * @brief Maps a priority value to support the append indicator.
>>   */
>> @@ -66,13 +60,13 @@ extern "C" {
>>   * @brief Clears the priority append indicator bit.
>>   */
>>  #define SCHEDULER_PRIORITY_PURIFY( priority )  \
>> -  ( ( priority ) & ~( (Priority_Control) SCHEDULER_PRIORITY_APPEND_FLAG ) )
>> +  ( ( priority ) & ~( (Priority_Control) PRIORITY_GROUP_LAST ) )
>>
>>  /**
>>   * @brief Returns the priority control with the append indicator bit set.
>>   */
>>  #define SCHEDULER_PRIORITY_APPEND( priority )  \
>> -  ( ( priority ) | SCHEDULER_PRIORITY_APPEND_FLAG )
>> +  ( ( priority ) | ( (Priority_Control) PRIORITY_GROUP_LAST ) )
>>
>>  /**
>>   * @brief Returns true, if the item should be appended to its priority group,
>> @@ -80,7 +74,7 @@ extern "C" {
>>   * group.
>>   */
>>  #define SCHEDULER_PRIORITY_IS_APPEND( priority ) \
>> -  ( ( ( priority ) & SCHEDULER_PRIORITY_APPEND_FLAG ) != 0 )
>> +  ( ( ( priority ) & ( (Priority_Control) PRIORITY_GROUP_LAST ) ) != 0 )
>>
>>  /**
>>   * @brief Initializes a node.
>> @@ -173,14 +167,17 @@ RTEMS_INLINE_ROUTINE Priority_Control _Scheduler_Node_get_priority(
>>  /**
>>   * @brief Sets the priority of the node.
>>   *
>> - * @param[in, out] node The node to set the priority of.
>> - * @param new_priority The new priority for @a node.
>> - * @param prepend_it Indicates whether the new priority should be prepended.
>> + * @param[in, out] node is the scheduler node.
>> + *
>> + * @param new_priority is the priority to set.
>> + *
>> + * @param group_order is the priority group order, see #PRIORITY_GROUP_FIRST
>> + *   and #PRIORITY_GROUP_LAST.
>>   */
>>  RTEMS_INLINE_ROUTINE void _Scheduler_Node_set_priority(
>> -  Scheduler_Node   *node,
>> -  Priority_Control  new_priority,
>> -  bool              prepend_it
>> +  Scheduler_Node      *node,
>> +  Priority_Control     new_priority,
>> +  Priority_Group_order group_order
>>  )
>>  {
>>  #if defined(RTEMS_SMP)
>> @@ -189,8 +186,7 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Node_set_priority(
>>    seq = _SMP_sequence_lock_Write_begin( &node->Priority.Lock );
>>  #endif
>>
>> -  new_priority |= ( prepend_it ? 0 : SCHEDULER_PRIORITY_APPEND_FLAG );
>> -  node->Priority.value = new_priority;
>> +  node->Priority.value = new_priority | ( (Priority_Control) group_order );
>>
>>  #if defined(RTEMS_SMP)
>>    _SMP_sequence_lock_Write_end( &node->Priority.Lock, seq );
>> diff --git a/cpukit/include/rtems/score/threadimpl.h b/cpukit/include/rtems/score/threadimpl.h
>> index ecc8eee058..c4b6c941a4 100644
>> --- a/cpukit/include/rtems/score/threadimpl.h
>> +++ b/cpukit/include/rtems/score/threadimpl.h
>> @@ -691,9 +691,10 @@ void _Thread_Priority_remove(
>>   *
>>   * @param the_thread The thread.
>>   * @param[out] priority_node The thread priority node to change.
>> - * @param prepend_it In case this is true, then the thread is prepended to
>> - *   its priority group in its home scheduler instance, otherwise it is
>> - *   appended.
>> + * @param priority_group_order The priority group order determines if the
>> + *   thread is inserted as the first or last node into the ready or scheduled
>> + *   queues of its home scheduler, see #PRIORITY_GROUP_FIRST and
>> + *   #PRIORITY_GROUP_LAST.
>>   * @param queue_context The thread queue context to return an updated set of
>>   *   threads for _Thread_Priority_update().  The thread queue context must be
>>   *   initialized via _Thread_queue_Context_clear_priority_updates() before a
>> @@ -704,7 +705,7 @@ void _Thread_Priority_remove(
>>  void _Thread_Priority_changed(
>>    Thread_Control       *the_thread,
>>    Priority_Node        *priority_node,
>> -  bool                  prepend_it,
>> +  Priority_Group_order  priority_group_order,
>>    Thread_queue_Context *queue_context
>>  );
>>
>> @@ -718,9 +719,10 @@ void _Thread_Priority_changed(
>>   * @param[out] priority_node The thread priority node to change.
>>   * @param new_priority The new thread priority value of the thread priority
>>   *   node to change.
>> - * @param prepend_it In case this is true, then the thread is prepended to
>> - *   its priority group in its home scheduler instance, otherwise it is
>> - *   appended.
>> + * @param priority_group_order The priority group order determines if the
>> + *   thread is inserted as the first or last node into the ready or scheduled
>> + *   queues of its home scheduler, see #PRIORITY_GROUP_FIRST and
>> + *   #PRIORITY_GROUP_LAST.
>>   * @param queue_context The thread queue context to return an updated set of
>>   *   threads for _Thread_Priority_update().  The thread queue context must be
>>   *   initialized via _Thread_queue_Context_clear_priority_updates() before a
>> @@ -732,7 +734,7 @@ RTEMS_INLINE_ROUTINE void _Thread_Priority_change(
>>    Thread_Control       *the_thread,
>>    Priority_Node        *priority_node,
>>    Priority_Control      new_priority,
>> -  bool                  prepend_it,
>> +  Priority_Group_order  priority_group_order,
>>    Thread_queue_Context *queue_context
>>  )
>>  {
>> @@ -740,7 +742,7 @@ RTEMS_INLINE_ROUTINE void _Thread_Priority_change(
>>    _Thread_Priority_changed(
>>      the_thread,
>>      priority_node,
>> -    prepend_it,
>> +    priority_group_order,
>>      queue_context
>>    );
>>  }
>> diff --git a/cpukit/posix/src/pthreadsetschedparam.c b/cpukit/posix/src/pthreadsetschedparam.c
>> index e9be24b417..1c207e7887 100644
>> --- a/cpukit/posix/src/pthreadsetschedparam.c
>> +++ b/cpukit/posix/src/pthreadsetschedparam.c
>> @@ -96,7 +96,7 @@ static int _POSIX_Set_sched_param(
>>      _Thread_Priority_changed(
>>        the_thread,
>>        &the_thread->Real_priority,
>> -      false,
>> +      PRIORITY_GROUP_LAST,
>>        queue_context
>>      );
>>  #if defined(RTEMS_POSIX_API)
>> diff --git a/cpukit/posix/src/pthreadsetschedprio.c b/cpukit/posix/src/pthreadsetschedprio.c
>> index 72c7dab273..ae2add6232 100644
>> --- a/cpukit/posix/src/pthreadsetschedprio.c
>> +++ b/cpukit/posix/src/pthreadsetschedprio.c
>> @@ -49,7 +49,7 @@ int pthread_setschedprio( pthread_t thread, int prio )
>>      the_thread,
>>      &the_thread->Real_priority,
>>      new_priority,
>> -    true,
>> +    PRIORITY_GROUP_FIRST,
>>      &queue_context
>>    );
>>
>> diff --git a/cpukit/rtems/src/tasksetpriority.c b/cpukit/rtems/src/tasksetpriority.c
>> index 50d1bc156c..532848ea52 100644
>> --- a/cpukit/rtems/src/tasksetpriority.c
>> +++ b/cpukit/rtems/src/tasksetpriority.c
>> @@ -50,7 +50,7 @@ static rtems_status_code _RTEMS_tasks_Set_priority(
>>      the_thread,
>>      &the_thread->Real_priority,
>>      core_new_priority,
>> -    false,
>> +    PRIORITY_GROUP_LAST,
>>      queue_context
>>    );
>>    cpu_self = _Thread_queue_Dispatch_disable( queue_context );
>> diff --git a/cpukit/score/src/scheduleredfreleasejob.c b/cpukit/score/src/scheduleredfreleasejob.c
>> index 443fdaeed5..4cccffc952 100644
>> --- a/cpukit/score/src/scheduleredfreleasejob.c
>> +++ b/cpukit/score/src/scheduleredfreleasejob.c
>> @@ -66,7 +66,7 @@ void _Scheduler_EDF_Release_job(
>>      _Thread_Priority_changed(
>>        the_thread,
>>        priority_node,
>> -      false,
>> +      PRIORITY_GROUP_LAST,
>>        queue_context
>>      );
>>    } else {
>> diff --git a/cpukit/score/src/threadchangepriority.c b/cpukit/score/src/threadchangepriority.c
>> index 13e9147916..ac2e9a6d0c 100644
>> --- a/cpukit/score/src/threadchangepriority.c
>> +++ b/cpukit/score/src/threadchangepriority.c
>> @@ -31,13 +31,13 @@
>>
>>  static void _Thread_Set_scheduler_node_priority(
>>    Priority_Aggregation *priority_aggregation,
>> -  bool                  prepend_it
>> +  Priority_Group_order  priority_group_order
>>  )
>>  {
>>    _Scheduler_Node_set_priority(
>>      SCHEDULER_NODE_OF_WAIT_PRIORITY_NODE( priority_aggregation ),
>>      _Priority_Get_priority( priority_aggregation ),
>> -    prepend_it
>> +    priority_group_order
>>    );
>>  }
>>
>> @@ -55,7 +55,10 @@ static void _Thread_Priority_action_add(
>>    the_thread = arg;
>>
>>    _Thread_Scheduler_add_wait_node( the_thread, scheduler_node );
>> -  _Thread_Set_scheduler_node_priority( priority_aggregation, false );
>> +  _Thread_Set_scheduler_node_priority(
>> +    priority_aggregation,
>> +    PRIORITY_GROUP_LAST
>> +  );
>>    _Priority_Set_action_type( priority_aggregation, PRIORITY_ACTION_ADD );
>>    _Priority_Actions_add( priority_actions, priority_aggregation );
>>  }
>> @@ -73,7 +76,10 @@ static void _Thread_Priority_action_remove(
>>    the_thread = arg;
>>
>>    _Thread_Scheduler_remove_wait_node( the_thread, scheduler_node );
>> -  _Thread_Set_scheduler_node_priority( priority_aggregation, true );
>> +  _Thread_Set_scheduler_node_priority(
>> +    priority_aggregation,
>> +    PRIORITY_GROUP_FIRST
>> +  );
>>    _Priority_Set_action_type( priority_aggregation, PRIORITY_ACTION_REMOVE );
>>    _Priority_Actions_add( priority_actions, priority_aggregation );
>>  }
>> @@ -81,12 +87,15 @@ static void _Thread_Priority_action_remove(
>>
>>  static void _Thread_Priority_action_change(
>>    Priority_Aggregation *priority_aggregation,
>> -  bool                  prepend_it,
>> +  Priority_Group_order  priority_group_order,
>>    Priority_Actions     *priority_actions,
>>    void                 *arg
>>  )
>>  {
>> -  _Thread_Set_scheduler_node_priority( priority_aggregation, prepend_it );
>> +  _Thread_Set_scheduler_node_priority(
>> +    priority_aggregation,
>> +    priority_group_order
>> +  );
>>  #if defined(RTEMS_SMP) || defined(RTEMS_DEBUG)
>>    _Priority_Set_action_type( priority_aggregation, PRIORITY_ACTION_CHANGE );
>>  #endif
>> @@ -97,7 +106,7 @@ static void _Thread_Priority_do_perform_actions(
>>    Thread_Control                *the_thread,
>>    Thread_queue_Queue            *queue,
>>    const Thread_queue_Operations *operations,
>> -  bool                           prepend_it,
>> +  Priority_Group_order           priority_group_order,
>>    Thread_queue_Context          *queue_context
>>  )
>>  {
>> @@ -162,7 +171,7 @@ static void _Thread_Priority_do_perform_actions(
>>          _Priority_Changed(
>>            priority_aggregation,
>>            priority_action_node,
>> -          prepend_it,
>> +          priority_group_order,
>>            &queue_context->Priority.Actions,
>>            _Thread_Priority_action_change,
>>            NULL
>> @@ -214,7 +223,7 @@ void _Thread_Priority_perform_actions(
>>        the_thread,
>>        queue,
>>        the_thread->Wait.operations,
>> -      false,
>> +      PRIORITY_GROUP_LAST,
>>        queue_context
>>      );
>>
>> @@ -244,7 +253,7 @@ static void _Thread_Priority_apply(
>>    Thread_Control       *the_thread,
>>    Priority_Node        *priority_action_node,
>>    Thread_queue_Context *queue_context,
>> -  bool                  prepend_it,
>> +  Priority_Group_order  priority_group_order,
>>    Priority_Action_type  priority_action_type
>>  )
>>  {
>> @@ -263,7 +272,7 @@ static void _Thread_Priority_apply(
>>      the_thread,
>>      queue,
>>      the_thread->Wait.operations,
>> -    prepend_it,
>> +    priority_group_order,
>>      queue_context
>>    );
>>
>> @@ -288,7 +297,7 @@ void _Thread_Priority_add(
>>      the_thread,
>>      priority_node,
>>      queue_context,
>> -    false,
>> +    PRIORITY_GROUP_LAST,
>>      PRIORITY_ACTION_ADD
>>    );
>>  }
>> @@ -303,7 +312,7 @@ void _Thread_Priority_remove(
>>      the_thread,
>>      priority_node,
>>      queue_context,
>> -    true,
>> +    PRIORITY_GROUP_FIRST,
>>      PRIORITY_ACTION_REMOVE
>>    );
>>  }
>> @@ -311,7 +320,7 @@ void _Thread_Priority_remove(
>>  void _Thread_Priority_changed(
>>    Thread_Control       *the_thread,
>>    Priority_Node        *priority_node,
>> -  bool                  prepend_it,
>> +  Priority_Group_order  priority_group_order,
>>    Thread_queue_Context *queue_context
>>  )
>>  {
>> @@ -319,7 +328,7 @@ void _Thread_Priority_changed(
>>      the_thread,
>>      priority_node,
>>      queue_context,
>> -    prepend_it,
>> +    priority_group_order,
>>      PRIORITY_ACTION_CHANGE
>>    );
>>  }
>> diff --git a/cpukit/score/src/threadqops.c b/cpukit/score/src/threadqops.c
>> index d6ba9dad57..eb01002679 100644
>> --- a/cpukit/score/src/threadqops.c
>> +++ b/cpukit/score/src/threadqops.c
>> @@ -700,7 +700,7 @@ static void _Thread_queue_Priority_inherit_do_priority_actions_remove(
>>
>>  static void _Thread_queue_Priority_inherit_do_priority_actions_change(
>>    Priority_Aggregation *priority_aggregation,
>> -  bool                  prepend_it,
>> +  Priority_Group_order  priority_group_order,
>>    Priority_Actions     *priority_actions,
>>    void                 *arg
>>  )
>> @@ -787,7 +787,7 @@ static void _Thread_queue_Priority_inherit_priority_actions(
>>          _Priority_Changed(
>>            &priority_queue->Queue,
>>            &scheduler_node->Wait.Priority.Node,
>> -          false,
>> +          PRIORITY_GROUP_LAST,
>>            priority_actions,
>>            _Thread_queue_Priority_inherit_do_priority_actions_change,
>>            scheduler_node_of_owner
>> @@ -884,7 +884,7 @@ static void _Thread_queue_Priority_inherit_do_initialize(
>>
>>  static void _Thread_queue_Priority_inherit_do_enqueue_change(
>>    Priority_Aggregation *priority_aggregation,
>> -  bool                  prepend_it,
>> +  Priority_Group_order  priority_group_order,
>>    Priority_Actions     *priority_actions,
>>    void                 *arg
>>  )
>> @@ -1079,7 +1079,7 @@ static void _Thread_queue_Priority_inherit_do_extract_remove(
>>
>>  static void _Thread_queue_Priority_inherit_do_extract_change(
>>    Priority_Aggregation *priority_aggregation,
>> -  bool                  prepend_it,
>> +  Priority_Group_order  priority_group_order,
>>    Priority_Actions     *priority_actions,
>>    void                 *arg
>>  )
>> @@ -1231,7 +1231,7 @@ static void _Thread_queue_Priority_inherit_do_surrender_add(
>>    _Scheduler_Node_set_priority(
>>      scheduler_node,
>>      _Priority_Get_priority( priority_aggregation ),
>> -    false
>> +    PRIORITY_GROUP_LAST
>>    );
>>  }
>>
>> @@ -1254,7 +1254,7 @@ static void _Thread_queue_Priority_inherit_do_surrender_remove(
>>
>>  static void _Thread_queue_Priority_inherit_do_surrender_change(
>>    Priority_Aggregation *priority_aggregation,
>> -  bool                  prepend_it,
>> +  Priority_Group_order  priority_group_order,
>>    Priority_Actions     *priority_actions,
>>    void                 *arg
>>  )
>> @@ -1270,14 +1270,14 @@ static void _Thread_queue_Priority_inherit_do_surrender_change(
>>    _Scheduler_Node_set_priority(
>>      SCHEDULER_NODE_OF_WAIT_PRIORITY( priority_aggregation ),
>>      _Priority_Get_priority( priority_aggregation ),
>> -    prepend_it
>> +    priority_group_order
>>    );
>>  }
>>
>>  #if defined(RTEMS_SMP)
>>  static void _Thread_queue_Priority_inherit_do_surrender_change_2(
>>    Priority_Aggregation *priority_aggregation,
>> -  bool                  prepend_it,
>> +  Priority_Group_order  priority_group_order,
>>    Priority_Actions     *priority_actions,
>>    void                 *arg
>>  )
>> @@ -1285,7 +1285,7 @@ static void _Thread_queue_Priority_inherit_do_surrender_change_2(
>>    _Scheduler_Node_set_priority(
>>      SCHEDULER_NODE_OF_WAIT_PRIORITY( priority_aggregation ),
>>      _Priority_Get_priority( priority_aggregation ),
>> -    prepend_it
>> +    priority_group_order
>>    );
>>  }
>>  #endif
>> diff --git a/cpukit/score/src/threadrestart.c b/cpukit/score/src/threadrestart.c
>> index 79a154e3d3..4b1907a2d9 100644
>> --- a/cpukit/score/src/threadrestart.c
>> +++ b/cpukit/score/src/threadrestart.c
>> @@ -70,7 +70,7 @@ static void _Thread_Raise_real_priority(
>>        the_thread,
>>        &the_thread->Real_priority,
>>        priority,
>> -      false,
>> +      PRIORITY_GROUP_LAST,
>>        &queue_context
>>      );
>>    }
>> @@ -576,7 +576,7 @@ Status_Control _Thread_Restart(
>>      the_thread,
>>      &the_thread->Real_priority,
>>      the_thread->Start.initial_priority,
>> -    false,
>> +    PRIORITY_GROUP_LAST,
>>      &queue_context
>>    );
>>    _Thread_Wait_release( the_thread, &queue_context );
>> diff --git a/testsuites/smptests/smpscheduler03/test.c b/testsuites/smptests/smpscheduler03/test.c
>> index 3f6b9e3fd8..8411f3ca2c 100644
>> --- a/testsuites/smptests/smpscheduler03/test.c
>> +++ b/testsuites/smptests/smpscheduler03/test.c
>> @@ -33,7 +33,7 @@ static Scheduler_SMP_Node *get_scheduler_node(Thread_Control *thread)
>>  static void apply_priority(
>>    Thread_Control *thread,
>>    Priority_Control new_priority,
>> -  bool prepend_it,
>> +  Priority_Group_order priority_group_order,
>>    Thread_queue_Context *queue_context
>>  )
>>  {
>> @@ -49,7 +49,7 @@ static void apply_priority(
>>      thread,
>>      &thread->Real_priority,
>>      new_priority,
>> -    prepend_it,
>> +    priority_group_order,
>>      queue_context
>>    );
>>    _Thread_Wait_release(thread, queue_context);
>> @@ -58,12 +58,12 @@ static void apply_priority(
>>  static void change_priority(
>>    Thread_Control *thread,
>>    Priority_Control new_priority,
>> -  bool prepend_it
>> +  Priority_Group_order priority_group_order
>>  )
>>  {
>>    Thread_queue_Context queue_context;
>>
>> -  apply_priority(thread, new_priority, prepend_it, &queue_context);
>> +  apply_priority(thread, new_priority, priority_group_order, &queue_context);
>>    _Thread_Priority_update(&queue_context);
>>  }
>>
>> @@ -110,7 +110,7 @@ static void test_case_change_priority(
>>    Scheduler_SMP_Node *executing_node,
>>    Scheduler_SMP_Node_state start_state,
>>    Priority_Control prio,
>> -  bool prepend_it,
>> +  Priority_Group_order priority_group_order,
>>    Scheduler_SMP_Node_state new_state
>>  )
>>  {
>> @@ -131,7 +131,7 @@ static void test_case_change_priority(
>>    }
>>    rtems_test_assert(executing_node->state == start_state);
>>
>> -  change_priority(executing, prio, prepend_it);
>> +  change_priority(executing, prio, priority_group_order);
>>    rtems_test_assert(executing_node->state == new_state);
>>
>>    change_priority(executing, 1, true);
>> @@ -147,7 +147,10 @@ static const Scheduler_SMP_Node_state states[2] = {
>>
>>  static const Priority_Control priorities[2] = { 2, 5 };
>>
>> -static const bool prepend_it[2] = { true, false };
>> +static const Priority_Group_order priority_group_order[2] = {
>> +  PRIORITY_GROUP_FIRST,
>> +  PRIORITY_GROUP_LAST
>> +};
>>
>>  static void test_change_priority(void)
>>  {
>> @@ -165,13 +168,13 @@ static void test_change_priority(void)
>>
>>    for (i = 0; i < RTEMS_ARRAY_SIZE(states); ++i) {
>>      for (j = 0; j < RTEMS_ARRAY_SIZE(priorities); ++j) {
>> -      for (k = 0; k < RTEMS_ARRAY_SIZE(prepend_it); ++k) {
>> +      for (k = 0; k < RTEMS_ARRAY_SIZE(priority_group_order); ++k) {
>>          test_case_change_priority(
>>            executing,
>>            executing_node,
>>            states[i],
>>            priorities[j],
>> -          prepend_it[k],
>> +          priority_group_order[k],
>>            states[j]
>>          );
>>        }
>> @@ -186,7 +189,7 @@ static void update_priority_op(
>>    Thread_Control *thread,
>>    Scheduler_SMP_Node *scheduler_node,
>>    Priority_Control new_priority,
>> -  bool prepend_it
>> +  Priority_Group_order priority_group_order
>>  )
>>  {
>>    const Scheduler_Control *scheduler;
>> @@ -194,7 +197,7 @@ static void update_priority_op(
>>    ISR_lock_Context scheduler_lock_context;
>>    Thread_queue_Context queue_context;
>>
>> -  apply_priority(thread, new_priority, prepend_it, &queue_context);
>> +  apply_priority(thread, new_priority, priority_group_order, &queue_context);
>>
>>    _Thread_State_acquire( thread, &state_lock_context );
>>    scheduler = _Thread_Scheduler_get_home( thread );
>> @@ -216,7 +219,7 @@ static void test_case_update_priority_op(
>>    Thread_Control *other,
>>    Scheduler_SMP_Node_state start_state,
>>    Priority_Control prio,
>> -  bool prepend_it,
>> +  Priority_Group_order priority_group_order,
>>    Scheduler_SMP_Node_state new_state
>>  )
>>  {
>> @@ -237,7 +240,7 @@ static void test_case_update_priority_op(
>>    }
>>    rtems_test_assert(executing_node->state == start_state);
>>
>> -  update_priority_op(executing, executing_node, prio, prepend_it);
>> +  update_priority_op(executing, executing_node, prio, priority_group_order);
>>    rtems_test_assert(executing_node->state == new_state);
>>
>>    if (start_state != new_state) {
>> @@ -279,14 +282,14 @@ static void test_update_priority_op(void)
>>
>>    for (i = 0; i < RTEMS_ARRAY_SIZE(states); ++i) {
>>      for (j = 0; j < RTEMS_ARRAY_SIZE(priorities); ++j) {
>> -      for (k = 0; k < RTEMS_ARRAY_SIZE(prepend_it); ++k) {
>> +      for (k = 0; k < RTEMS_ARRAY_SIZE(priority_group_order); ++k) {
>>          test_case_update_priority_op(
>>            executing,
>>            executing_node,
>>            other,
>>            states[i],
>>            priorities[j],
>> -          prepend_it[k],
>> +          priority_group_order[k],
>>            states[j]
>>          );
>>        }
>> --
>> 2.26.2
>>
>> _______________________________________________
>> devel mailing list
>> devel at rtems.org
>> http://lists.rtems.org/mailman/listinfo/devel
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
> 


More information about the devel mailing list