From nobody Fri May 29 20:57:42 2026 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 4gRwfb0mrtz6g5mW for ; Fri, 29 May 2026 20:57:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (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-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R13" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gRwfZ6W1yz445w for ; Fri, 29 May 2026 20:57:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780088262; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=xBObN6Hha1nQJ1wnb+tMLpEDty+UCAaRn5dTlbMQhFw=; b=pUxhQqQRuQuMwLMIoPok7Vosd+TDR81KrblqeFph9KWRiJwtyJwMoBOtIBJHZdzqZNjAkt 7EZSxQwdqw0DmedfGan76ehj+/9Se4JuK8oMJ9+oKoUlgRJN0o5aI2ir8fqDMwHGbmbu8m k3kzeVvRnV3mudyglUKJj0D2bu2ya4UJOq+9jU2lmNWo9gmwU5Rz+EWevChUDv9UPqc6ns UkbKZvVa3ZooQuUoggsBPmTl7ab8rSP/TTNBf5Fto/BuElFFLZONBJyb5LkvQA9eKhIT/+ Mixt0aUx6hoNzraooeEzyU3CcupS1EILxwC5ZP7CKg2Zo2XjQpvGqcyL7YeEaA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780088262; a=rsa-sha256; cv=none; b=QFRKcDS7BnI+Y/0wNEOCti39xws/Qyuf3p/JfIGQ5FaF1sMrpRm0qcLaq6ipqDmImzV4i7 4FHb+8U82nwpPam5Kstp5pS26C/SvbcSAxj0Pa+Lze2RVSF5pgQqUsmLfE8SyFjKRpbmko VgrDthPH1PJsnwfszEfk4s3Q48zQObNCNB3AHWwmv7XIP1ZMSm4psSl+BOsa0u8To6/UvQ 7qWy1NO5PqNlOX3wbAqRyXFhq1UGdlsfXsAY3p6053vPG+wZi56Ysth1OEWiXx4CVNk1fH QezBj4+n0vxLga2+tl3iFHT6ssC/bhdSgCQeIskYthcu05ZBWlDqdN8eah3uwg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780088262; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=xBObN6Hha1nQJ1wnb+tMLpEDty+UCAaRn5dTlbMQhFw=; b=v3d/VOYSwJUUQI7JaW0bvc0EhIb2FM2EWRMXUPhvNuzVmzAsW2m7TIFJ1OnnrB7pfJJjJy x9fLOv9qMsx4Y/eQY+6HZO1u0/GQdeD6YZUpn4D2Bk5nKPd4WXZJoFE+bKrvBIiRcrYMHq rPBrln//aaFlU08A2MG3pgw5Xnp7JSeJ3nEw8QStLjoPYW4utWlzV/NFbbCDuwHeY+O3Bi WEZ5sBDd93/QX8lD1MOAyaeGXMyUm+bZbkXbG7Ev+YnkES4fEumi7BwFQkSoyXPo6SK/OU 3eVh4hh1mGOQuEfSAPxTBghy7MYyXxRIQabISWzTPFHioWyMDrhhxQjAcvU1rg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gRwfZ5rFCzpw5 for ; Fri, 29 May 2026 20:57:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 346e6 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 29 May 2026 20:57:42 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 81e894d5f3b4 - stable/14 - epoch: Don't idle CPUs when there's pending epoch work 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 81e894d5f3b4809979113cfdb4d8da047e833bd7 Auto-Submitted: auto-generated Date: Fri, 29 May 2026 20:57:42 +0000 Message-Id: <6a19fdc6.346e6.7af651e0@gitrepo.freebsd.org> The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=81e894d5f3b4809979113cfdb4d8da047e833bd7 commit 81e894d5f3b4809979113cfdb4d8da047e833bd7 Author: Mark Johnston AuthorDate: 2026-04-21 14:28:31 +0000 Commit: Mark Johnston CommitDate: 2026-05-29 19:44:43 +0000 epoch: Don't idle CPUs when there's pending epoch work The epoch(9) subsystem implements per-CPU queues of object destructors which get invoked once it is safe to do so. These queues are polled via hardclock(). When a CPU is about to go idle, we reduce the hardclock frequency to 1Hz by default, to avoid unneeded wakeups. This means that if there is any garbage in these destructor queues, it won't be cleared for at least 1s (and possibly longer) even if it would otherwise be safe to do so. epoch_drain_callbacks() is used in some places to provide a barrier, ensuring that all garbage present in the destructor queues is cleaned up before returning. It's implemented by adding a fake destructor in the queues and blocking until it gets run on all CPUs. The above-described phenomenon means that it can take a long time for these calls to return, even (especially) when some CPUs are idle. This causes long delays when destroying VNET jails, for instance, as epoch_drain_callbacks() is invoked each time a network interface is destroyed. Work around this problem by not disabling the hardclock timer if there is garbage present in the destructor queues. The implementation of epoch_drain_callbacks() has other problems, but this small change on its own gives a good improvement, especially when running networking regression tests. Moreover, we should aim to invoke destructors in a timely manner, so the change is generally beneficial. Reviewed by: glebius MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D56508 (cherry picked from commit dce56594991464c276f340ce963d0f5461566c78) --- sys/kern/kern_clocksource.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/kern/kern_clocksource.c b/sys/kern/kern_clocksource.c index 6bf3bbd83245..637610654648 100644 --- a/sys/kern/kern_clocksource.c +++ b/sys/kern/kern_clocksource.c @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -235,7 +236,7 @@ getnextcpuevent(struct pcpu_state *state, int idle) /* Handle hardclock() events, skipping some if CPU is idle. */ event = state->nexthard; - if (idle) { + if (idle && DPCPU_GET(epoch_cb_count) == 0) { if (tc_min_ticktock_freq > 1 #ifdef SMP && curcpu == CPU_FIRST()