summaryrefslogtreecommitdiffstats
path: root/cpukit/score/include/rtems/score/schedulersmpimpl.h
diff options
context:
space:
mode:
Diffstat (limited to 'cpukit/score/include/rtems/score/schedulersmpimpl.h')
-rw-r--r--cpukit/score/include/rtems/score/schedulersmpimpl.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/cpukit/score/include/rtems/score/schedulersmpimpl.h b/cpukit/score/include/rtems/score/schedulersmpimpl.h
index 61fbff534f..20c5d17ee7 100644
--- a/cpukit/score/include/rtems/score/schedulersmpimpl.h
+++ b/cpukit/score/include/rtems/score/schedulersmpimpl.h
@@ -92,12 +92,14 @@ static inline void _Scheduler_SMP_Allocate_processor(
_Thread_Set_CPU( heir, cpu_of_victim );
+ cpu_of_victim->heir = heir;
+
/*
- * FIXME: Here we need atomic store operations with a relaxed memory order.
- * The _CPU_SMP_Send_interrupt() will ensure that the change can be
- * observed consistently.
+ * It is critical that we first update the heir and then the dispatch
+ * necessary so that _Thread_Dispatch() cannot miss an update.
*/
- cpu_of_victim->heir = heir;
+ _Atomic_Fence( ATOMIC_ORDER_RELEASE );
+
cpu_of_victim->dispatch_necessary = true;
if ( cpu_of_victim != cpu_of_executing ) {