From owner-svn-src-head@FreeBSD.ORG Fri Sep 10 13:24:47 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5B3331065675; Fri, 10 Sep 2010 13:24:47 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4B1FA8FC0C; Fri, 10 Sep 2010 13:24:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8ADOlis047279; Fri, 10 Sep 2010 13:24:47 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8ADOld7047277; Fri, 10 Sep 2010 13:24:47 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201009101324.o8ADOld7047277@svn.freebsd.org> From: Alexander Motin Date: Fri, 10 Sep 2010 13:24:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212416 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2010 13:24:47 -0000 Author: mav Date: Fri Sep 10 13:24:47 2010 New Revision: 212416 URL: http://svn.freebsd.org/changeset/base/212416 Log: Do not IPI CPU that is already spinning for load. It doubles effect of spining (comparing to MWAIT) on some heavly switching test loads. Modified: head/sys/kern/sched_ule.c Modified: head/sys/kern/sched_ule.c ============================================================================== --- head/sys/kern/sched_ule.c Fri Sep 10 12:55:36 2010 (r212415) +++ head/sys/kern/sched_ule.c Fri Sep 10 13:24:47 2010 (r212416) @@ -196,7 +196,7 @@ static int preempt_thresh = 0; #endif static int static_boost = PRI_MIN_TIMESHARE; static int sched_idlespins = 10000; -static int sched_idlespinthresh = 4; +static int sched_idlespinthresh = 64; /* * tdq - per processor runqs and statistics. All fields are protected by the @@ -208,6 +208,7 @@ struct tdq { struct mtx tdq_lock; /* run queue lock. */ struct cpu_group *tdq_cg; /* Pointer to cpu topology. */ volatile int tdq_load; /* Aggregate load. */ + volatile int tdq_cpu_idle; /* cpu_idle() is active. */ int tdq_sysload; /* For loadavg, !ITHD load. */ int tdq_transferable; /* Transferable thread count. */ short tdq_switchcnt; /* Switches this tick. */ @@ -966,7 +967,7 @@ tdq_notify(struct tdq *tdq, struct threa * If the MD code has an idle wakeup routine try that before * falling back to IPI. */ - if (cpu_idle_wakeup(cpu)) + if (!tdq->tdq_cpu_idle || cpu_idle_wakeup(cpu)) return; } tdq->tdq_ipipending = 1; @@ -2545,8 +2546,14 @@ sched_idletd(void *dummy) } } switchcnt = tdq->tdq_switchcnt + tdq->tdq_oldswitchcnt; - if (tdq->tdq_load == 0) - cpu_idle(switchcnt > 1); + if (tdq->tdq_load == 0) { + tdq->tdq_cpu_idle = 1; + if (tdq->tdq_load == 0) { + cpu_idle(switchcnt > sched_idlespinthresh); + tdq->tdq_switchcnt++; + } + tdq->tdq_cpu_idle = 0; + } if (tdq->tdq_load) { thread_lock(td); mi_switch(SW_VOL | SWT_IDLE, NULL);