summaryrefslogtreecommitdiffstats
path: root/cpukit/libmisc
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2019-12-07 11:48:36 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2019-12-11 09:05:07 +0100
commit01f8c12ee57230fca1581e1b5be91f3decba0488 (patch)
tree279ef8193d107ea59490e3fdeb18d20639c54f36 /cpukit/libmisc
parentscore: Optimize _TLS_Get_size() (diff)
downloadrtems-01f8c12ee57230fca1581e1b5be91f3decba0488.tar.bz2
rtems: Optimize semaphore control block
Move variant, discipline, and global information to flags stored in a node pointer of active semaphores. Update #3833.
Diffstat (limited to 'cpukit/libmisc')
-rw-r--r--cpukit/libmisc/monitor/mon-sema.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/cpukit/libmisc/monitor/mon-sema.c b/cpukit/libmisc/monitor/mon-sema.c
index 87e784ea74..fabc3c952b 100644
--- a/cpukit/libmisc/monitor/mon-sema.c
+++ b/cpukit/libmisc/monitor/mon-sema.c
@@ -18,7 +18,8 @@ rtems_monitor_sema_canonical(
const void *sema_void
)
{
- const Semaphore_Control *rtems_sema = (const Semaphore_Control *) sema_void;
+ const Semaphore_Control *rtems_sema;
+ uintptr_t flags;
Thread_Control *owner;
canonical_sema->attribute = 0;
@@ -27,17 +28,20 @@ rtems_monitor_sema_canonical(
canonical_sema->cur_count = 0;
canonical_sema->holder_id = 0;
+ rtems_sema = (const Semaphore_Control *) sema_void;
+ flags = _Semaphore_Get_flags( rtems_sema );
+
#if defined(RTEMS_MULTIPROCESSING)
- if (rtems_sema->is_global) {
+ if ( _Semaphore_Is_global( flags ) ) {
canonical_sema->attribute |= RTEMS_GLOBAL;
}
#endif
- if (rtems_sema->discipline == SEMAPHORE_DISCIPLINE_PRIORITY) {
+ if ( _Semaphore_Get_discipline( flags ) == SEMAPHORE_DISCIPLINE_PRIORITY ) {
canonical_sema->attribute |= RTEMS_PRIORITY;
}
- switch ( rtems_sema->variant ) {
+ switch ( _Semaphore_Get_variant( flags ) ) {
case SEMAPHORE_VARIANT_MUTEX_INHERIT_PRIORITY:
canonical_sema->attribute |= RTEMS_BINARY_SEMAPHORE
| RTEMS_INHERIT_PRIORITY;
@@ -63,7 +67,7 @@ rtems_monitor_sema_canonical(
break;
}
- switch ( rtems_sema->variant ) {
+ switch ( _Semaphore_Get_variant( flags ) ) {
case SEMAPHORE_VARIANT_MUTEX_PRIORITY_CEILING:
canonical_sema->priority_ceiling = _Scheduler_Unmap_priority(
_CORE_ceiling_mutex_Get_scheduler( &rtems_sema->Core_control.Mutex ),