Skip to content

Assign idle task to each core before the SMP scheduler start #945

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 14 additions & 24 deletions tasks.c
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
Expand Down Expand Up @@ -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
}
}

Expand Down