mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-09-21 11:08:59 +08:00
score: Fix default set affinity
The set of online processors must be a subset of the thread processor affinity for the schedulers without arbitrary processor affinity support to avoid problems in case of processor addition and removal. Update #3059.
This commit is contained in:
@@ -612,10 +612,9 @@ RTEMS_INLINE_ROUTINE bool _Scheduler_default_Set_affinity_body(
|
||||
const Processor_mask *affinity
|
||||
)
|
||||
{
|
||||
return _Processor_mask_Is_subset(
|
||||
affinity,
|
||||
_Scheduler_Get_processors( scheduler )
|
||||
);
|
||||
(void) scheduler;
|
||||
(void) the_thread;
|
||||
return _Processor_mask_Is_subset( affinity, _SMP_Get_online_processors() );
|
||||
}
|
||||
|
||||
bool _Scheduler_Set_affinity(
|
||||
|
||||
@@ -223,9 +223,7 @@ static void test(void)
|
||||
CPU_ZERO(&second_cpu);
|
||||
CPU_SET(1, &second_cpu);
|
||||
|
||||
CPU_ZERO(&all_cpus);
|
||||
CPU_SET(0, &all_cpus);
|
||||
CPU_SET(1, &all_cpus);
|
||||
CPU_FILL(&all_cpus);
|
||||
|
||||
CPU_ZERO(&online_cpus);
|
||||
CPU_SET(0, &online_cpus);
|
||||
@@ -348,6 +346,9 @@ static void test(void)
|
||||
rtems_test_assert(scheduler_id == scheduler_b_id);
|
||||
|
||||
sc = rtems_task_set_affinity(task_id, sizeof(second_cpu), &second_cpu);
|
||||
rtems_test_assert(sc == RTEMS_INVALID_NUMBER);
|
||||
|
||||
sc = rtems_task_set_affinity(task_id, sizeof(online_cpus), &online_cpus);
|
||||
rtems_test_assert(sc == RTEMS_SUCCESSFUL);
|
||||
|
||||
sc = rtems_task_get_scheduler(task_id, &scheduler_id);
|
||||
|
||||
Reference in New Issue
Block a user