[PATCH 08/27] score: Add missing idle thread exchanges

Gedare Bloom gedare at rtems.org
Sat Nov 20 18:58:07 UTC 2021


On Mon, Nov 15, 2021 at 10:13 AM Sebastian Huber
<sebastian.huber at embedded-brains.de> wrote:
>
> Update #4531.
> ---
>  cpukit/include/rtems/score/schedulersmpimpl.h | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
>
> diff --git a/cpukit/include/rtems/score/schedulersmpimpl.h b/cpukit/include/rtems/score/schedulersmpimpl.h
> index 944b4fc976..a074b53a16 100644
> --- a/cpukit/include/rtems/score/schedulersmpimpl.h
> +++ b/cpukit/include/rtems/score/schedulersmpimpl.h
> @@ -1098,6 +1098,15 @@ static inline void _Scheduler_SMP_Schedule_highest_ready(
>          victim,
>          _Scheduler_SMP_Release_idle_thread
>        );
> +    } else if ( action == SCHEDULER_TRY_TO_SCHEDULE_DO_IDLE_EXCHANGE ) {
> +      _Scheduler_SMP_Node_change_state(
> +        highest_ready,
> +        SCHEDULER_SMP_NODE_SCHEDULED
> +      );
> +
> +      ( *move_from_ready_to_scheduled )( context, highest_ready );
> +
> +      _Scheduler_Exchange_idle_thread( highest_ready, victim );
>      } else {
>        _Assert( action == SCHEDULER_TRY_TO_SCHEDULE_DO_BLOCK );
>
> @@ -1162,6 +1171,15 @@ static inline void _Scheduler_SMP_Preempt_and_schedule_highest_ready(
>          victim,
>          _Scheduler_SMP_Release_idle_thread
>        );
> +    } else if ( action == SCHEDULER_TRY_TO_SCHEDULE_DO_IDLE_EXCHANGE ) {
> +      _Scheduler_SMP_Node_change_state(
> +        highest_ready,
> +        SCHEDULER_SMP_NODE_SCHEDULED
> +      );
> +
> +      ( *move_from_ready_to_scheduled )( context, highest_ready );
> +
> +      _Scheduler_Exchange_idle_thread( highest_ready, victim );
>      } else {
>        _Assert( action == SCHEDULER_TRY_TO_SCHEDULE_DO_BLOCK );
>

A bit unrelated, these two functions could be refactored/merged, with
a callout function passed in to select either _Scheduler_SMP_Preempt()
or _Scheduler_SMP_Allocate_processor().

> --
> 2.26.2
>
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel


More information about the devel mailing list