mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2026-06-19 17:43:42 +02:00
Add affinity to IDLE tasks in SMP systems (#1415)
This commit is contained in:
parent
a8c9d35152
commit
d3b074a01e
@ -558,6 +558,13 @@
|
|||||||
* tskNO_AFFINITY if left undefined. */
|
* tskNO_AFFINITY if left undefined. */
|
||||||
#define configTIMER_SERVICE_TASK_CORE_AFFINITY tskNO_AFFINITY
|
#define configTIMER_SERVICE_TASK_CORE_AFFINITY tskNO_AFFINITY
|
||||||
|
|
||||||
|
/* When using SMP (i.e. configNUMBER_OF_CORES is greater than one), set
|
||||||
|
* configIDLE_AFFINITY to 1 to pin each Idle task to its corresponding
|
||||||
|
* core. When set to 1, Idle task N will only run on core N, using an affinity
|
||||||
|
* mask of (1 << N). Set to 0 to allow the scheduler to run Idle tasks on any
|
||||||
|
* available core. Defaults to 0 if left undefined. */
|
||||||
|
#define configIDLE_AFFINITY 0
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
/* ARMv8-M secure side port related definitions. ******************************/
|
/* ARMv8-M secure side port related definitions. ******************************/
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|||||||
@ -377,6 +377,10 @@
|
|||||||
#define configIDLE_SHOULD_YIELD 1
|
#define configIDLE_SHOULD_YIELD 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef configIDLE_AFFINITY
|
||||||
|
#define configIDLE_AFFINITY 0
|
||||||
|
#endif
|
||||||
|
|
||||||
#if configMAX_TASK_NAME_LEN < 1
|
#if configMAX_TASK_NAME_LEN < 1
|
||||||
#error configMAX_TASK_NAME_LEN must be set to a minimum of 1 in FreeRTOSConfig.h
|
#error configMAX_TASK_NAME_LEN must be set to a minimum of 1 in FreeRTOSConfig.h
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
7
tasks.c
7
tasks.c
@ -3687,8 +3687,13 @@ static BaseType_t prvCreateIdleTasks( void )
|
|||||||
/* Assign idle task to each core before SMP scheduler is running. */
|
/* Assign idle task to each core before SMP scheduler is running. */
|
||||||
xIdleTaskHandles[ xCoreID ]->xTaskRunState = xCoreID;
|
xIdleTaskHandles[ xCoreID ]->xTaskRunState = xCoreID;
|
||||||
pxCurrentTCBs[ xCoreID ] = xIdleTaskHandles[ xCoreID ];
|
pxCurrentTCBs[ xCoreID ] = xIdleTaskHandles[ xCoreID ];
|
||||||
|
#if ( ( configIDLE_AFFINITY == 1 ) && ( configUSE_CORE_AFFINITY == 1 ) )
|
||||||
|
{
|
||||||
|
xIdleTaskHandles[ xCoreID ]->uxCoreAffinityMask = ( ( UBaseType_t ) 1U << ( UBaseType_t ) xCoreID );
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* if ( configNUMBER_OF_CORES == 1 ) */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user