From owner-freebsd-arch@freebsd.org Mon Sep 9 22:53:20 2019 Return-Path: Delivered-To: freebsd-arch@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6DDC5E427E for ; Mon, 9 Sep 2019 22:53:20 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound3d.ore.mailhop.org (outbound3d.ore.mailhop.org [54.186.57.195]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 46S3Nc1jGxz4lpN for ; Mon, 9 Sep 2019 22:53:19 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1568069599; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=ZIjL4T8YP9vGoYs7pAUM2+7U7CKDo309aOzLHNa6mWPpVsMSa5oH1um/if5HpSjlVxYkutjtbYjvC 1k137l5wmTVjeqhDPSmIGt8X0xQAzt8Z9DHtwQN36dFL2bPiVlDcEWX2gzZX6Q+m5g0nYX4LQXT68N 7V96xCHuqaFT2Vb27XRY14OfoiLS06IzdU9PiSGpn/ylGaJNcrRfpf+ueYcld9djOpOEcICoCRNbUg K63bvd1sqk2K25LAM6mugXNkJQCR8upCYpTAhiOPKlDIP/kNngeDTdfLsxu9zPXbVGV8WQMvUgRkfG ZEKg75VUcQMD8QQOSB91x+/XVwUKHRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:cc:to:from:subject:message-id:dkim-signature:from; bh=LKfOE6E4p5S0XtwaQgo4zi4uLaYTl6BPdTdialp2I24=; b=XutNN9Qc3luCZbGixxGu1PkwQ211vTCdDekMRh+36EGY16IqGx/u5XXB140p5+SfwvA5cTTDdRZme YNQawZagdMv+e1WbaUBsHHuVjnqSNdH3imKKopl/6wZ7bcSmFUpuLalKXiKQQIHFSn/m49DKxW1URq vJLym+F2FoJy29//CjYbwE3DOj3oiUmdTAfDu/Wbw+5oTbH6/ZUy5Y+ozh6i8Gb6VV0QHI8VZwWZpM aHRlmqGXiZXn9uBg/M6nBvihu9YQ4GaWJoGHDUU3kVgok9QEt+lChOhedAQBTRr9xP9+PrhzXn/SUQ Yp4ziNyy7PmYNq3knDxUl4Uz7VBIMVw== ARC-Authentication-Results: i=1; outbound3.ore.mailhop.org; spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=67.177.211.60; dmarc=none header.from=freebsd.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:cc:to:from:subject:message-id:from; bh=LKfOE6E4p5S0XtwaQgo4zi4uLaYTl6BPdTdialp2I24=; b=IRDzeE95aAyS6PDvCHTL7pzLIzuSa7bhtgKrJFVh+mjss+sNY3Pt89Yv2QrIj90ek/HKgaKGuO5Fe xnENUO2gnM9b/Hc3crF6/wYO2qKzMLSiInehepE0yxbwx1DajHjUVHa01xx1GBpHPhUYaat1bomBGh IsW8S/35GF8bjx/h+f/k9ayA0TimRo5y/ksYTVydmXOB6V+08vnoU5LSRPezbuncOgyz0zK+oeeIs0 Qo4zrHiDsxtBFWIdvIC1SOJ99P9admabSvlm/2eS/H1T5ctPbb8Er3QDJD1wCMcaZ7kH4f1mBpWvOD t0dO470bWEkgT2m5um8CogySS+yMwtw== X-MHO-RoutePath: aGlwcGll X-MHO-User: 9c6827ac-d354-11e9-b67d-cdd75d6ce7a8 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 67.177.211.60 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [67.177.211.60]) by outbound3.ore.mailhop.org (Halon) with ESMTPSA id 9c6827ac-d354-11e9-b67d-cdd75d6ce7a8; Mon, 09 Sep 2019 22:53:17 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id x89MrG7o064009; Mon, 9 Sep 2019 16:53:16 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: <16539c09c4b65c2f5d239e78d88e9d9985ba588b.camel@freebsd.org> Subject: Re: What value HZ? From: Ian Lepore To: cem@freebsd.org Cc: "freebsd-arch@freebsd.org" Date: Mon, 09 Sep 2019 16:53:16 -0600 In-Reply-To: References: <201909060119.x861JWrG006910@repo.freebsd.org> <4917d7507b6ea6c360dccda261f53052aa085f2b.camel@freebsd.org> <5EE266EE-E650-48D8-9B0E-E674AD026470@freebsd.org> <3cb6429acc7e520932d2c906d1cac47540156355.camel@freebsd.org> <8F03EA29-0F3F-4321-9241-78F7C924FDE1@freebsd.org> <9BC03B61-F8B5-476C-AD34-9DEA5230BFCF@freebsd.org> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 FreeBSD GNOME Team Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 46S3Nc1jGxz4lpN X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-2.00 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; ASN(0.00)[asn:16509, ipnet:54.186.0.0/15, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Sep 2019 22:53:20 -0000 On Sat, 2019-09-07 at 18:58 -0700, Conrad Meyer wrote: > Hi Constantine, > > On Sat, Sep 7, 2019 at 3:05 PM Constantine A. Murenin > wrote: > > > > For the sake of discussion, I recall that there was a measurable power > > consumption difference between FreeBSD (HZ=1000) and OpenBSD (HZ=100) when > > I played with a Kill-A-Watt a number of years ago. > > Unfortunately, this is an apples to oranges comparison, and perhaps > worse, vague and dated. It would be more interesting to compare > HZ=1000 to HZ=100 with an otherwise identical CURRENT FreeBSD system. > > As far as I can tell, FreeBSD grew "tickless" timer support in r212541 > in 2010 (thanks mav@). This is easily observed on my idle HZ=1000 > amd64 system with 'vmstat -i': "cpu0:timer" is firing at an average > rate of 21 Hz — not 1000. And that is the most frequent interrupt. > > > Would it perhaps be prudent to try to qualify whether, and by how much, > > this change affects power consumption on MIPS/ARM/RISCV, not just whether > > each arch could cope with the change? > > If someone has the time and inclination, then of course, it could be > an interesting test to run. In this mail, when I say HZ, I mean also 'hz' the global var that's tunable... When I saw this conversation moved to arch@ my first thought was "Good, we can finally have the conversation I've been trying to have with people for years." But, alas, the focus even here is still just "100 vs 1000", not the base question I really want to see answered. I'm replying to this message in the thread because it comes closest to touching on that base question, which is: What, exactly, does HZ control and affect these days? It no longer controls how often periodic timer interrupts happen, except on a few rare systems that don't support one-shot style event timers. I'm not sure any such systems even still exist, now that we've nuked most of the old armv4 support. If they do exist, I'm pretty sure it's only in the MIPS arch. It no longer controls the scheduling quantum for a process or thread. Or so I've been told, I'm pretty ignorant about the workings of both schedulers. It no longer controls the minimum amount of time a userland process can sleep when calling the usleep() or nanosleep() functions. The one thing I know for sure that HZ affects is whatever code still exists that schedules timeouts in terms of 'ticks' rather than using the newer SBT flavor of sleeping functions. Old-school pause(9) and msleep(9) and others that take a timeout in 'ticks' will have the timeout granularity implied by HZ, and there is still such code around in various device drivers and other places. Aside from old-school tick-based sleep functions, does HZ do anything anymore? -- Ian