From nobody Mon Jan 10 02:33:34 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 844C31948772; Mon, 10 Jan 2022 02:33:43 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4JXHvC1rjzz3QvT; Mon, 10 Jan 2022 02:33:42 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.16.1/8.16.1) with ESMTPS id 20A2XZKo043478 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Mon, 10 Jan 2022 04:33:38 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 20A2XZKo043478 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 20A2XYan043477; Mon, 10 Jan 2022 04:33:34 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 10 Jan 2022 04:33:34 +0200 From: Konstantin Belousov To: Alexander Motin Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: cb1f5d11366d - main - Reduce minimum idle hardclock rate from 2Hz to 1Hz. Message-ID: References: <202201100026.20A0Q1fs045878@gitrepo.freebsd.org> List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202201100026.20A0Q1fs045878@gitrepo.freebsd.org> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.5 X-Spam-Checker-Version: SpamAssassin 3.4.5 (2021-03-20) on tom.home X-Rspamd-Queue-Id: 4JXHvC1rjzz3QvT X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N On Mon, Jan 10, 2022 at 12:26:01AM +0000, Alexander Motin wrote: > The branch main has been updated by mav: > > URL: https://cgit.FreeBSD.org/src/commit/?id=cb1f5d11366dc9b803f2755d83fe02599830882a > > commit cb1f5d11366dc9b803f2755d83fe02599830882a > Author: Alexander Motin > AuthorDate: 2022-01-10 00:17:43 +0000 > Commit: Alexander Motin > CommitDate: 2022-01-10 00:25:56 +0000 > > Reduce minimum idle hardclock rate from 2Hz to 1Hz. > > On idle 80-thread system it allows to improve package-level idle state > residency and so power consumption by several percent. Are you sure that this is safe? Our timecounters are tailored to wrap at 1sec, at least the most precise/ important TSC-low is. If idle system interrupts with 1Hz frequency, it probably comes dangerously close to situations where tc_windup() could be missed. > > MFC after: 2 weeks > --- > sys/kern/kern_clocksource.c | 5 +++-- > sys/kern/kern_timeout.c | 5 ++--- > 2 files changed, 5 insertions(+), 5 deletions(-) > > diff --git a/sys/kern/kern_clocksource.c b/sys/kern/kern_clocksource.c > index dfc9081ba9f6..48e06ee082fc 100644 > --- a/sys/kern/kern_clocksource.c > +++ b/sys/kern/kern_clocksource.c > @@ -239,13 +239,14 @@ getnextcpuevent(int idle) > /* Handle hardclock() events, skipping some if CPU is idle. */ > event = state->nexthard; > if (idle) { > - hardfreq = (u_int)hz / 2; > - if (tc_min_ticktock_freq > 2 > + if (tc_min_ticktock_freq > 1 > #ifdef SMP > && curcpu == CPU_FIRST() > #endif > ) > hardfreq = hz / tc_min_ticktock_freq; > + else > + hardfreq = hz; > if (hardfreq > 1) > event += tick_sbt * (hardfreq - 1); > } > diff --git a/sys/kern/kern_timeout.c b/sys/kern/kern_timeout.c > index 91882ddb5fba..d0fb19661fa4 100644 > --- a/sys/kern/kern_timeout.c > +++ b/sys/kern/kern_timeout.c > @@ -434,8 +434,7 @@ callout_process(sbintime_t now) > struct callout_cpu *cc; > struct callout_list *sc; > struct thread *td; > - sbintime_t first, last, max, tmp_max; > - uint32_t lookahead; > + sbintime_t first, last, lookahead, max, tmp_max; > u_int firstb, lastb, nowb; > #ifdef CALLOUT_PROFILING > int depth_dir = 0, mpcalls_dir = 0, lockcalls_dir = 0; > @@ -455,7 +454,7 @@ callout_process(sbintime_t now) > else if (nowb - firstb == 1) > lookahead = (SBT_1S / 8); > else > - lookahead = (SBT_1S / 2); > + lookahead = SBT_1S; > first = last = now; > first += (lookahead / 2); > last += lookahead;