From owner-freebsd-stable@FreeBSD.ORG Thu Oct 4 19:08:04 2007 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 C421716A41A for ; Thu, 4 Oct 2007 19:08:04 +0000 (UTC) (envelope-from dillon@apollo.backplane.com) Received: from apollo.backplane.com (apollo.backplane.com [216.240.41.2]) by mx1.freebsd.org (Postfix) with ESMTP id 9FE2713C49D for ; Thu, 4 Oct 2007 19:08:04 +0000 (UTC) (envelope-from dillon@apollo.backplane.com) Received: from apollo.backplane.com (localhost [127.0.0.1]) by apollo.backplane.com (8.14.1/8.13.7) with ESMTP id l94Iq3vJ021958; Thu, 4 Oct 2007 11:52:03 -0700 (PDT) Received: (from dillon@localhost) by apollo.backplane.com (8.14.1/8.13.4/Submit) id l94Iq3Db021957; Thu, 4 Oct 2007 11:52:03 -0700 (PDT) Date: Thu, 4 Oct 2007 11:52:03 -0700 (PDT) From: Matthew Dillon Message-Id: <200710041852.l94Iq3Db021957@apollo.backplane.com> To: cpghost References: <02d401c805cb$abf59ec0$0c00a8c0@Artem> <200710041232.l94CWd6W056143@lurza.secnetix.de> <20071004143944.GA46491@nowhere> <009201c8069d$2f3edc20$0c00a8c0@Artem> <20071004180522.3a724868@epia-2.farid-hajji.net> Cc: Artem Kuchin , freebsd-stable@freebsd.org, Craig Boston Subject: Re: Quation about HZ kernel option 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: Thu, 04 Oct 2007 19:08:04 -0000 The basic answer is that HZ is almost, but not quite irrelevant. If a process blocks another will immediately be scheduled. More importantly, if an interrupt driven event (keyboard, tty, network, disk, etc) wakes a process up the scheduler has the ability to force an IMMEDIATE reschedule. Nearly ALL process related events schedule the process from this sort of reschedule. Generally speaking only cpu-bound processes will be hitting the schedular quantum on a regular basis. For network protocols HZ is the basis for the timeout subsystem which is only triggered when things actually time-out, which is fairly rare in a normally running system. Queue timers, select timeouts, and nanosleep are restricted by HZ in granularity, but in nearly all cases those calls are used with very large timeouts not really subject to the granularity of HZ. I think a higher HZ can be somewhat beneficial if you are running a lot of processes which fall through the scheduler's cracks (both cpu and disk bound, usually), or if the scheduler is badly written, but otherwise a lower value will not have much of an effect. I would not go under 100, though. I personally believe that a default of 1000 is ridiculously high, especially on a SMP system. -Matt