Date: Sun, 14 Sep 2014 22:13:19 +0000 (UTC) From: Alexander Motin <mav@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r271604 - head/sys/kern Message-ID: <201409142213.s8EMDJdM065051@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mav Date: Sun Sep 14 22:13:19 2014 New Revision: 271604 URL: http://svnweb.freebsd.org/changeset/base/271604 Log: 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 Modified: head/sys/kern/sched_ule.c Modified: head/sys/kern/sched_ule.c ============================================================================== --- head/sys/kern/sched_ule.c Sun Sep 14 22:10:35 2014 (r271603) +++ head/sys/kern/sched_ule.c Sun Sep 14 22:13:19 2014 (r271604) @@ -1037,6 +1037,7 @@ tdq_notify(struct tdq *tdq, struct threa 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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201409142213.s8EMDJdM065051>