Change the mb() use in the sched_ult tdq_notify() and sched_idletd()

to more C11-ish atomic_thread_fence_seq_cst().

Note that on PowerPC, which currently uses lwsync for mb(), the change
actually fixes the missed store/load barrier, intended by r271604 [*].

Reviewed by:	alc
Noted by:	alc [*]
Sponsored by:	The FreeBSD Foundation
MFC after:	3 weeks
This commit is contained in:
Konstantin Belousov 2015-07-10 08:54:12 +00:00
parent 249d5c7acc
commit e8677f3885
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=285353

View File

@ -1057,7 +1057,7 @@ tdq_notify(struct tdq *tdq, struct thread *td)
* globally visible before we read tdq_cpu_idle. Idle thread
* accesses both of them without locks, and the order is important.
*/
mb();
atomic_thread_fence_seq_cst();
if (TD_IS_IDLETHREAD(ctd)) {
/*
@ -2667,7 +2667,7 @@ sched_idletd(void *dummy)
* before cpu_idle() read tdq_load. The order is important
* to avoid race with tdq_notify.
*/
mb();
atomic_thread_fence_seq_cst();
cpu_idle(switchcnt * 4 > sched_idlespinthresh);
tdq->tdq_cpu_idle = 0;