summaryrefslogtreecommitdiffstats
path: root/cpukit/score/include/rtems
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2017-07-04 08:59:37 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2017-07-07 07:36:31 +0200
commit0232b28df10549d64dcc6d9fc68a332014dac8eb (patch)
tree5c5a43f51fe93858f86412f817bb05d54960fc81 /cpukit/score/include/rtems
parentrtems: Fix rtems_scheduler_remove_processor() (diff)
downloadrtems-0232b28df10549d64dcc6d9fc68a332014dac8eb.tar.bz2
score: Use processor mask for set affinity
Update #3059.
Diffstat (limited to 'cpukit/score/include/rtems')
-rw-r--r--cpukit/score/include/rtems/score/scheduler.h17
-rw-r--r--cpukit/score/include/rtems/score/schedulerimpl.h31
-rw-r--r--cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h6
3 files changed, 13 insertions, 41 deletions
diff --git a/cpukit/score/include/rtems/score/scheduler.h b/cpukit/score/include/rtems/score/scheduler.h
index 7a3ae6b466..5f3fb01206 100644
--- a/cpukit/score/include/rtems/score/scheduler.h
+++ b/cpukit/score/include/rtems/score/scheduler.h
@@ -207,8 +207,7 @@ typedef struct {
bool ( *set_affinity )(
const Scheduler_Control *,
Thread_Control *,
- size_t,
- const cpu_set_t *
+ const Processor_mask *
);
#endif
} Scheduler_Operations;
@@ -507,23 +506,19 @@ void _Scheduler_default_Start_idle(
#if defined(RTEMS_SMP)
/**
- * @brief Set affinity for the default scheduler.
+ * @brief Default implementation of the set affinity scheduler operation.
*
* @param[in] scheduler The scheduler instance.
* @param[in] thread The associated thread.
- * @param[in] cpusetsize The size of the cpuset.
- * @param[in] cpuset Affinity new affinity set.
+ * @param[in] affinity The new processor affinity set for the thread.
*
- * @retval 0 Successful
- *
- * This method always returns successful and does not save
- * the cpuset.
+ * @retval true The processor set of the scheduler is a subset of the affinity set.
+ * @retval false Otherwise.
*/
bool _Scheduler_default_Set_affinity(
const Scheduler_Control *scheduler,
Thread_Control *thread,
- size_t cpusetsize,
- const cpu_set_t *cpuset
+ const Processor_mask *affinity
);
#define SCHEDULER_OPERATION_DEFAULT_GET_SET_AFFINITY \
diff --git a/cpukit/score/include/rtems/score/schedulerimpl.h b/cpukit/score/include/rtems/score/schedulerimpl.h
index 895f116066..6f220acf57 100644
--- a/cpukit/score/include/rtems/score/schedulerimpl.h
+++ b/cpukit/score/include/rtems/score/schedulerimpl.h
@@ -609,34 +609,13 @@ bool _Scheduler_Get_affinity(
RTEMS_INLINE_ROUTINE bool _Scheduler_default_Set_affinity_body(
const Scheduler_Control *scheduler,
Thread_Control *the_thread,
- size_t cpusetsize,
- const cpu_set_t *cpuset
+ const Processor_mask *affinity
)
{
- uint32_t cpu_count = _SMP_Get_processor_count();
- uint32_t cpu_index;
- bool ok = true;
-
- for ( cpu_index = 0 ; cpu_index < cpu_count ; ++cpu_index ) {
-#if defined(RTEMS_SMP)
- const Per_CPU_Control *cpu;
- const Scheduler_Control *scheduler_of_cpu;
-
- cpu = _Per_CPU_Get_by_index( cpu_index );
- scheduler_of_cpu = _Scheduler_Get_by_CPU( cpu );
-
- ok = ok
- && ( CPU_ISSET_S( (int) cpu_index, cpusetsize, cpuset )
- || ( !CPU_ISSET_S( (int) cpu_index, cpusetsize, cpuset )
- && scheduler != scheduler_of_cpu ) );
-#else
- (void) scheduler;
-
- ok = ok && CPU_ISSET_S( (int) cpu_index, cpusetsize, cpuset );
-#endif
- }
-
- return ok;
+ return _Processor_mask_Is_subset(
+ affinity,
+ _Scheduler_Get_processors( scheduler )
+ );
}
bool _Scheduler_Set_affinity(
diff --git a/cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h b/cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h
index fd4a33670f..d53f76b090 100644
--- a/cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h
+++ b/cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h
@@ -141,8 +141,7 @@ Thread_Control *_Scheduler_priority_affinity_SMP_Remove_processor(
*
* @param[in] scheduler The scheduler of the thread.
* @param[in] thread The associated thread.
- * @param[in] cpusetsize The size of the cpuset.
- * @param[in] cpuset Affinity new affinity set.
+ * @param[in] affinity The new affinity set.
*
* @retval true if successful
* @retval false if unsuccessful
@@ -150,8 +149,7 @@ Thread_Control *_Scheduler_priority_affinity_SMP_Remove_processor(
bool _Scheduler_priority_affinity_SMP_Set_affinity(
const Scheduler_Control *scheduler,
Thread_Control *thread,
- size_t cpusetsize,
- const cpu_set_t *cpuset
+ const Processor_mask *affinity
);
/**