diff options
Diffstat (limited to 'cpukit')
-rw-r--r-- | cpukit/posix/src/pthreadcreate.c | 9 | ||||
-rw-r--r-- | cpukit/score/src/schedulerpriorityaffinitysmp.c | 19 |
2 files changed, 10 insertions, 18 deletions
diff --git a/cpukit/posix/src/pthreadcreate.c b/cpukit/posix/src/pthreadcreate.c index 41e2b67122..75205f7e0a 100644 --- a/cpukit/posix/src/pthreadcreate.c +++ b/cpukit/posix/src/pthreadcreate.c @@ -29,7 +29,6 @@ #include <rtems/posix/pthreadimpl.h> #include <rtems/posix/pthreadattrimpl.h> #include <rtems/score/assert.h> -#include <rtems/score/cpusetimpl.h> #include <rtems/score/threadimpl.h> #include <rtems/score/apimutex.h> #include <rtems/score/stackimpl.h> @@ -170,11 +169,9 @@ int pthread_create( return EINVAL; } -#if defined(RTEMS_SMP) - status = _CPU_set_Is_valid(the_attr->affinityset, the_attr->affinitysetsize); - if ( !status ) + if ( the_attr->affinityset == NULL ) { return EINVAL; -#endif + } /* * Currently all POSIX threads are floating point if the hardware @@ -223,7 +220,6 @@ int pthread_create( the_thread->Life.state |= THREAD_LIFE_CHANGE_DEFERRED; -#if defined(RTEMS_SMP) _ISR_lock_ISR_disable( &lock_context ); status = _Scheduler_Set_affinity( the_thread, @@ -236,7 +232,6 @@ int pthread_create( _RTEMS_Unlock_allocator(); return EINVAL; } -#endif /* * finish initializing the per API structure diff --git a/cpukit/score/src/schedulerpriorityaffinitysmp.c b/cpukit/score/src/schedulerpriorityaffinitysmp.c index c35883f142..e8301226f3 100644 --- a/cpukit/score/src/schedulerpriorityaffinitysmp.c +++ b/cpukit/score/src/schedulerpriorityaffinitysmp.c @@ -23,9 +23,6 @@ #include <rtems/score/schedulerpriorityimpl.h> #include <rtems/score/schedulersmpimpl.h> #include <rtems/score/schedulerprioritysmpimpl.h> -#include <rtems/score/wkspace.h> -#include <rtems/score/cpusetimpl.h> - #include <rtems/score/priority.h> /* @@ -606,27 +603,27 @@ bool _Scheduler_priority_affinity_SMP_Set_affinity( const Processor_mask *affinity ) { + Scheduler_Context *context; Scheduler_priority_affinity_SMP_Node *node; States_Control current_state; + Processor_mask my_affinity; cpu_set_t cpuset; - size_t cpusetsize; - cpusetsize = sizeof( cpuset ); - _Processor_mask_To_cpu_set_t( affinity, cpusetsize, &cpuset ); - /* - * Validate that the cpset meets basic requirements. - */ - if ( !_CPU_set_Is_valid( &cpuset, cpusetsize ) ) { + context = _Scheduler_Get_context( scheduler ); + _Processor_mask_And( &my_affinity, &context->Processors, affinity ); + + if ( _Processor_mask_Count( &my_affinity ) == 0 ) { return false; } + _Processor_mask_To_cpu_set_t( &my_affinity, sizeof( cpuset ), &cpuset ); node = _Scheduler_priority_affinity_SMP_Node_downcast( node_base ); /* * The old and new set are the same, there is no point in * doing anything. */ - if ( CPU_EQUAL_S( cpusetsize, &cpuset, node->Affinity.set ) ) + if ( CPU_EQUAL( &cpuset, node->Affinity.set ) ) return true; current_state = thread->current_state; |