mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-19 21:11:57 -04:00
Assign idle task to each core before SMP scheduler start (#945)
Co-authored-by: Rahul Kar <118818625+kar-rahul-aws@users.noreply.github.com>
This commit is contained in:
parent
460e953076
commit
94cb87ad30
38
tasks.c
38
tasks.c
|
@ -2108,29 +2108,9 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
|
||||||
mtCOVERAGE_TEST_MARKER();
|
mtCOVERAGE_TEST_MARKER();
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ( pxNewTCB->uxTaskAttributes & taskATTRIBUTE_IS_IDLE ) != 0U )
|
/* All the cores start with idle tasks before the SMP scheduler
|
||||||
{
|
* is running. Idle tasks are assigned to cores when they are
|
||||||
BaseType_t xCoreID;
|
* created in prvCreateIdleTasks(). */
|
||||||
|
|
||||||
/* 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();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uxTaskNumber++;
|
uxTaskNumber++;
|
||||||
|
@ -3645,7 +3625,17 @@ static BaseType_t prvCreateIdleTasks( void )
|
||||||
}
|
}
|
||||||
else
|
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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue