Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FreeRTOS/FreeRTOS-Kernel.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchinglee-iot <61685396+chinglee-iot@users.noreply.github.com>2024-01-09 09:03:47 +0300
committerGitHub <noreply@github.com>2024-01-09 09:03:47 +0300
commit94cb87ad30a638dfc22585954494becea19918e6 (patch)
tree40b4861b22ea4c083d8b4a425b7d2c1ecac48c94
parent460e953076b9ceff74fc5583e3da12140ca05690 (diff)
Assign idle task to each core before SMP scheduler start (#945)
Co-authored-by: Rahul Kar <118818625+kar-rahul-aws@users.noreply.github.com>
-rw-r--r--tasks.c38
1 files changed, 14 insertions, 24 deletions
diff --git a/tasks.c b/tasks.c
index 279d4bdb3..93e9c02c4 100644
--- a/tasks.c
+++ b/tasks.c
@@ -2108,29 +2108,9 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
mtCOVERAGE_TEST_MARKER();
}
- if( ( pxNewTCB->uxTaskAttributes & taskATTRIBUTE_IS_IDLE ) != 0U )
- {
- BaseType_t xCoreID;
-
- /* Check if a core is free. */
- for( xCoreID = ( BaseType_t ) 0; xCoreID < ( BaseType_t ) configNUMBER_OF_CORES; xCoreID++ )
- {
- if( pxCurrentTCBs[ xCoreID ] == NULL )
- {
- pxNewTCB->xTaskRunState = xCoreID;
- pxCurrentTCBs[ xCoreID ] = pxNewTCB;
- break;
- }
- else
- {
- mtCOVERAGE_TEST_MARKER();
- }
- }
- }
- else
- {
- mtCOVERAGE_TEST_MARKER();
- }
+ /* All the cores start with idle tasks before the SMP scheduler
+ * is running. Idle tasks are assigned to cores when they are
+ * created in prvCreateIdleTasks(). */
}
uxTaskNumber++;
@@ -3645,7 +3625,17 @@ static BaseType_t prvCreateIdleTasks( void )
}
else
{
- mtCOVERAGE_TEST_MARKER();
+ #if ( configNUMBER_OF_CORES == 1 )
+ {
+ mtCOVERAGE_TEST_MARKER();
+ }
+ #else
+ {
+ /* Assign idle task to each core before SMP scheduler is running. */
+ xIdleTaskHandles[ xCoreID ]->xTaskRunState = xCoreID;
+ pxCurrentTCBs[ xCoreID ] = xIdleTaskHandles[ xCoreID ];
+ }
+ #endif
}
}