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:
Sebastian Huber
2017-07-07 07:56:24 +02:00
parent 76d119857f
commit 16347a6b39
2 changed files with 7 additions and 7 deletions
@@ -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(
+4 -3
View File
@@ -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);