@@ -2982,19 +2982,13 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
2982
2982
{
2983
2983
TCB_t * pxTCB ;
2984
2984
BaseType_t xCoreID ;
2985
- UBaseType_t uxPrevCoreAffinityMask ;
2986
-
2987
- #if ( configUSE_PREEMPTION == 1 )
2988
- UBaseType_t uxPrevNotAllowedCores ;
2989
- #endif
2990
2985
2991
2986
traceENTER_vTaskCoreAffinitySet ( xTask , uxCoreAffinityMask );
2992
2987
2993
2988
taskENTER_CRITICAL ();
2994
2989
{
2995
2990
pxTCB = prvGetTCBFromHandle ( xTask );
2996
2991
2997
- uxPrevCoreAffinityMask = pxTCB -> uxCoreAffinityMask ;
2998
2992
pxTCB -> uxCoreAffinityMask = uxCoreAffinityMask ;
2999
2993
3000
2994
if ( xSchedulerRunning != pdFALSE )
@@ -3014,17 +3008,14 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
3014
3008
{
3015
3009
#if ( configUSE_PREEMPTION == 1 )
3016
3010
{
3017
- /* Calculate the cores on which this task was not allowed to
3018
- * run previously. */
3019
- uxPrevNotAllowedCores = ( ~uxPrevCoreAffinityMask ) & ( ( 1U << configNUMBER_OF_CORES ) - 1U );
3020
-
3021
- /* Does the new core mask enables this task to run on any of the
3022
- * previously not allowed cores? If yes, check if this task can be
3023
- * scheduled on any of those cores. */
3024
- if ( ( uxPrevNotAllowedCores & uxCoreAffinityMask ) != 0U )
3025
- {
3026
- prvYieldForTask ( pxTCB );
3027
- }
3011
+ /* The SMP scheduler requests a core to yield when a ready
3012
+ * task is able to run. It is possible that the core affinity
3013
+ * of the ready task is changed before the requested core
3014
+ * can select it to run. In that case, the task may not be
3015
+ * selected by the previously requested core due to core affinity
3016
+ * constraint and the SMP scheduler must select a new core to
3017
+ * yield for the task. */
3018
+ prvYieldForTask ( xTask );
3028
3019
}
3029
3020
#else /* #if( configUSE_PREEMPTION == 1 ) */
3030
3021
{
0 commit comments