freertos(IDF): Restore vanilla task selection algorithm for single core

This commit restores the vanilla behavior for taskSELECT_HIGHEST_PRIORITY_TASK
when configNUM_CORES == 1 && configUSE_PORT_OPTIMISED_TASK_SELECTION == 0. This
results in the SMP selection algorithm (taskSelectHighestPriorityTaskSMP) to
only be run when configNUM_CORES > 1.
This commit is contained in:
Darian Leung
2022-11-23 16:48:34 +08:00
parent 2537dd8eca
commit dff138f883

View File

@@ -145,9 +145,9 @@
/*-----------------------------------------------------------*/
#ifdef ESP_PLATFORM
#if ( configNUM_CORES > 1 )
#define taskSELECT_HIGHEST_PRIORITY_TASK() taskSelectHighestPriorityTaskSMP()
#else //ESP_PLATFORM
#else /* configNUM_CORES > 1 */
#define taskSELECT_HIGHEST_PRIORITY_TASK() \
{ \
UBaseType_t uxTopPriority = uxTopReadyPriority; \
@@ -161,10 +161,10 @@
\
/* listGET_OWNER_OF_NEXT_ENTRY indexes through the list, so the tasks of \
* the same priority get an equal share of the processor time. */ \
listGET_OWNER_OF_NEXT_ENTRY( pxCurrentTCB[ xPortGetCoreID() ], &( pxReadyTasksLists[ uxTopPriority ] ) ); \
listGET_OWNER_OF_NEXT_ENTRY( pxCurrentTCB[ 0 ], &( pxReadyTasksLists[ uxTopPriority ] ) ); \
uxTopReadyPriority = uxTopPriority; \
} /* taskSELECT_HIGHEST_PRIORITY_TASK */
#endif //ESP_PLATFORM
#endif /* configNUM_CORES > 1 */
/*-----------------------------------------------------------*/
@@ -192,7 +192,7 @@
/* Find the highest priority list that contains ready tasks. */ \
portGET_HIGHEST_PRIORITY( uxTopPriority, uxTopReadyPriority ); \
configASSERT( listCURRENT_LIST_LENGTH( &( pxReadyTasksLists[ uxTopPriority ] ) ) > 0 ); \
listGET_OWNER_OF_NEXT_ENTRY( pxCurrentTCB[ xPortGetCoreID() ], &( pxReadyTasksLists[ uxTopPriority ] ) ); \
listGET_OWNER_OF_NEXT_ENTRY( pxCurrentTCB[ 0 ], &( pxReadyTasksLists[ uxTopPriority ] ) ); \
} /* taskSELECT_HIGHEST_PRIORITY_TASK() */
/*-----------------------------------------------------------*/
@@ -3509,8 +3509,7 @@ BaseType_t xTaskIncrementTick( void )
#endif /* configUSE_APPLICATION_TASK_TAG */
/*-----------------------------------------------------------*/
#ifdef ESP_PLATFORM
#if ( configUSE_PORT_OPTIMISED_TASK_SELECTION == 0 )
#if ( configNUM_CORES > 1 )
static void taskSelectHighestPriorityTaskSMP( void )
{
/* This function is called from a critical section. So some optimizations are made */
@@ -3596,8 +3595,7 @@ get_next_task:
assert( xTaskScheduled == pdTRUE ); /* At this point, a task MUST have been scheduled */
}
#endif /* configUSE_PORT_OPTIMISED_TASK_SELECTION */
#endif //ESP_PLATFORM
#endif /* configNUM_CORES > 1 */
void vTaskSwitchContext( void )
{