[PATCH v2 06/15] rtems: Fix rtems_scheduler_remove_processor()
Gedare Bloom
gedare at rtems.org
Sun Jul 9 12:00:14 UTC 2017
On Sun, Jul 9, 2017 at 7:57 AM, Gedare Bloom <gedare at rtems.org> wrote:
> On Fri, Jul 7, 2017 at 9:54 AM, Sebastian Huber
> <sebastian.huber at embedded-brains.de> wrote:
>> Account for the thread processor affinity and make sure that it is
>> possible to allocate a processor to each thread dedicated to a scheduler
>> instance.
>>
>> Update #3059.
>> ---
>> cpukit/rtems/src/schedulerremoveprocessor.c | 12 ++++++++----
>> 1 file changed, 8 insertions(+), 4 deletions(-)
>>
>> diff --git a/cpukit/rtems/src/schedulerremoveprocessor.c b/cpukit/rtems/src/schedulerremoveprocessor.c
>> index 538366bb22..06acacd158 100644
>> --- a/cpukit/rtems/src/schedulerremoveprocessor.c
>> +++ b/cpukit/rtems/src/schedulerremoveprocessor.c
>> @@ -45,7 +45,13 @@ static bool _Scheduler_Check_processor_removal(
>> _Thread_Wait_acquire( the_thread, &queue_context );
>> _Thread_State_acquire_critical( the_thread, &state_context );
>>
>> - if ( _Thread_Scheduler_get_home( the_thread ) == iter_context->scheduler ) {
>> + if (
>> + _Thread_Scheduler_get_home( the_thread ) == iter_context->scheduler
>> + && !_Processor_mask_Has_overlap(
>> + &the_thread->Scheduler.Affinity,
>> + _Scheduler_Get_processors( iter_context->scheduler )
>> + )
>
> It may be worth it to add a new function like
> _Thread_Is_affine(Thread_Control *t, Processor_mask *m) that checks if
> t is contained in m. This would be easier to interpret than the above
> inverted use of _Has_overlap().
>
Perhaps the _Get_affinity() function works like this after the
following patch #7?
>> + ) {
>> iter_context->status = RTEMS_RESOURCE_IN_USE;
>> }
>>
>> @@ -103,9 +109,7 @@ rtems_status_code rtems_scheduler_remove_processor(
>> _Scheduler_Release_critical( scheduler, &lock_context );
>> _ISR_lock_ISR_enable( &lock_context );
>>
>> - if ( processor_count == 0 ) {
>> - _Thread_Iterate( _Scheduler_Check_processor_removal, &iter_context );
>> - }
>> + _Thread_Iterate( _Scheduler_Check_processor_removal, &iter_context );
>>
>> _ISR_lock_ISR_disable( &lock_context );
>> _Scheduler_Acquire_critical( scheduler, &lock_context );
>> --
>> 2.12.3
>>
>> _______________________________________________
>> devel mailing list
>> devel at rtems.org
>> http://lists.rtems.org/mailman/listinfo/devel
More information about the devel
mailing list