From owner-freebsd-stable@FreeBSD.ORG Tue Sep 7 06:04:11 2010 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A83B210656D3; Tue, 7 Sep 2010 06:04:11 +0000 (UTC) (envelope-from avg@icyb.net.ua) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 83D508FC12; Tue, 7 Sep 2010 06:04:10 +0000 (UTC) Received: from porto.topspin.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id JAA15425; Tue, 07 Sep 2010 09:04:05 +0300 (EEST) (envelope-from avg@icyb.net.ua) Received: from localhost.topspin.kiev.ua ([127.0.0.1]) by porto.topspin.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1OsrHp-000Mfm-BD; Tue, 07 Sep 2010 09:04:05 +0300 Message-ID: <4C85D5D4.1020201@icyb.net.ua> Date: Tue, 07 Sep 2010 09:04:04 +0300 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.2.8) Gecko/20100822 Lightning/1.0b2 Thunderbird/3.1.2 MIME-Version: 1.0 To: Jeremy Chadwick References: <4C7F7C0F.8080004@icyb.net.ua> <4C818F65.3000603@freebsd.org> <4C853B91.4090601@DataIX.net> <20100907055438.GA20878@icarus.home.lan> In-Reply-To: <20100907055438.GA20878@icarus.home.lan> X-Enigmail-Version: 1.1.2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: jhell , freebsd-stable@freebsd.org, David Xu , Ivan Voras , jan.grant@bristol.ac.uk Subject: Re: Tuning the scheduler? Desktop with a CPU-intensive task becomes rapidly unusable. X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2010 06:04:11 -0000 on 07/09/2010 08:54 Jeremy Chadwick said the following: > Can someone explain exactly what this sysctl does? The description is > only useful if you have familiarity with the scheduler internals: > > $ sysctl -d kern.sched.preempt_thresh > kern.sched.preempt_thresh: Min priority for preemption, lower priorities have greater precedence > > The source code doesn't really explain it either -- but I will point out > that there's a change in the default value based on an option called > FULL_PREEMPTION: > > src/sys/kern/sched_ule.c > 192 #ifdef PREEMPTION > 193 #ifdef FULL_PREEMPTION > 194 static int preempt_thresh = PRI_MAX_IDLE; > 195 #else > 196 static int preempt_thresh = PRI_MIN_KERN; > 197 #endif > 198 #else > 199 static int preempt_thresh = 0; > 200 #endif > > src/sys/sys/priority.h > 81 #define PRI_MAX (255) /* Lowest priority. */ > 97 #define PRI_MIN_KERN (64) > ... > 121 #define PRI_MAX_IDLE (PRI_MAX) > Well, I think you quoted almost all relevant source to get an understanding. Take a look also at sched_shouldpreempt() in sched_ule.c. -- Andriy Gapon