summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2014-09-14 22:13:19 +0000
committermav <mav@FreeBSD.org>2014-09-14 22:13:19 +0000
commit1cfaa7d62ba4ad88a87e3d3c7d9b1c7fc51059a0 (patch)
treecb7a2bdd13fd7cc0cd6fd16bce82d4b95a22a7c5 /sys/kern
parent80ccb248ca5a4784c12f1eb4893ff05034603733 (diff)
downloadFreeBSD-src-1cfaa7d62ba4ad88a87e3d3c7d9b1c7fc51059a0.zip
FreeBSD-src-1cfaa7d62ba4ad88a87e3d3c7d9b1c7fc51059a0.tar.gz
Add couple memory barries to serialize tdq_cpu_idle and tdq_load accesses.
This change fixes transient performance drops in some of my benchmarks, vanishing as soon as I am trying to collect any stats from the scheduler. It looks like reordered access to those variables sometimes caused loss of IPI_PREEMPT, that delayed thread execution until some later interrupt. MFC after: 3 days
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/sched_ule.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c
index 0a63c01..7fe902e 100644
--- a/sys/kern/sched_ule.c
+++ b/sys/kern/sched_ule.c
@@ -1037,6 +1037,7 @@ tdq_notify(struct tdq *tdq, struct thread *td)
ctd = pcpu_find(cpu)->pc_curthread;
if (!sched_shouldpreempt(pri, ctd->td_priority, 1))
return;
+ mb();
if (TD_IS_IDLETHREAD(ctd)) {
/*
* If the MD code has an idle wakeup routine try that before
@@ -2640,6 +2641,7 @@ sched_idletd(void *dummy)
/* Run main MD idle handler. */
tdq->tdq_cpu_idle = 1;
+ mb();
cpu_idle(switchcnt * 4 > sched_idlespinthresh);
tdq->tdq_cpu_idle = 0;
OpenPOWER on IntegriCloud