@@ -2982,19 +2982,13 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
29822982 {
29832983 TCB_t * pxTCB ;
29842984 BaseType_t xCoreID ;
2985- UBaseType_t uxPrevCoreAffinityMask ;
2986-
2987- #if ( configUSE_PREEMPTION == 1 )
2988- UBaseType_t uxPrevNotAllowedCores ;
2989- #endif
29902985
29912986 traceENTER_vTaskCoreAffinitySet ( xTask , uxCoreAffinityMask );
29922987
29932988 taskENTER_CRITICAL ();
29942989 {
29952990 pxTCB = prvGetTCBFromHandle ( xTask );
29962991
2997- uxPrevCoreAffinityMask = pxTCB -> uxCoreAffinityMask ;
29982992 pxTCB -> uxCoreAffinityMask = uxCoreAffinityMask ;
29992993
30002994 if ( xSchedulerRunning != pdFALSE )
@@ -3014,17 +3008,14 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
30143008 {
30153009 #if ( configUSE_PREEMPTION == 1 )
30163010 {
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 );
30283019 }
30293020 #else /* #if( configUSE_PREEMPTION == 1 ) */
30303021 {
0 commit comments