From nobody Thu Jan 25 15:02:33 2024 X-Original-To: dev-commits-src-branches@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 4TLPFP6xWmz57QXD; Thu, 25 Jan 2024 15:02:33 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4TLPFP6R4pz4phB; Thu, 25 Jan 2024 15:02:33 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1706194953; 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=pin40ANgThdeyF5+ZkgJwIHRnC/TE9MN79049Ue+S+8=; b=S/oBOGypQpOhvU+BioU8ZPgI/CN1lvhMzZJFJLCJBCwHqJqndKpxLOzxiE1K5eb4/Jt/I+ hYc7q8H4p/6Nde1iRHWJZ/oJ2bk1re49JaPVeral1LMRy/P/qFed1KG+mFgX8U15fxryOe VoL/sEyMtaF+NFwj+T3htpN4iBd0wUHbzT4ewt9o1QTASMhtmGGty8sTv5G8GzH1IgJhRI r1x18Cxu6bN3oT9WV5tnHfToHvwZJJMngVYpAWHfgHprIpB9vvYa8/Ug0zhwxhJzbgyuG7 uH+ViOUa51NCdMAUkJRDcUirWBi3q9NkhEvd6dY/gxjavkuTyV1f6lnTnZANiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1706194953; 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=pin40ANgThdeyF5+ZkgJwIHRnC/TE9MN79049Ue+S+8=; b=YsEbnRJvnniwEtbXPOMFFjKgX86GF6ztwl70kFZ/YQsweMrrEDMBNlaLDZ+Bf4bSMVetdU Ll7VxpJFDr448vYnRaU1ldjRtauJ56vNz6SVo+yZVHw5JIKKDheaAQT5c0b6WdHK1saJqb bYx2MOr+umTypda9hcbgm+/pKDG7Up/hgLMaiXXlu7am3r74MVOqoG4+0h0hI+hh+vt8LE 1aC90GuwECjWwcOa/+RUZIrPKmqh2jdNMldPBVT6sAOPf6tD/afHa9rUrSpp+K5K5Djckj KIMsraY4AXfInHkPbR91B0gytJIW0hzbJaaj9oqkeU41g/8o1FYhfTiO2cHdIw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1706194953; a=rsa-sha256; cv=none; b=VTXY4Mx5fleTkataMHLakmkbJg25EQ4gZCZEzBKF/mnaDl/lTFVnS9lmSWrCRpi0YGJnDj WDSYkcqvYskK317mAz8khzz5viLK2oGFD6BEwaGhMdUK2D8WtvYBsnQ4IN45qWEnWEVgtH 3O0YGKNR7Obh9JvND07LmS8WOR1si4WOmaJxefENfcUB1d8bfArKivdqNRbmUck6xzaJl3 Eu03QDNlMjD+GXHplzlL31aq95yfxRzSxIyqX8oKQlofJNGMETqVqtH5hvzy/OB6jTDlTk tV4pSAPbv6nTDrt2+InmJbWhDpEHoMruJUJN1vzdflA8ZdJr+M3a4O4IE8O46Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4TLPFP5RZzz12n9; Thu, 25 Jan 2024 15:02:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 40PF2XNi057129; Thu, 25 Jan 2024 15:02:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 40PF2X9u057126; Thu, 25 Jan 2024 15:02:33 GMT (envelope-from git) Date: Thu, 25 Jan 2024 15:02:33 GMT Message-Id: <202401251502.40PF2X9u057126@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 1c090bf880bf - stable/14 - top: Avoid printing a blank line when the ZFS ARC is empty List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org 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: 1c090bf880bf8879f75e4cd4b93c9a277faef2fa Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=1c090bf880bf8879f75e4cd4b93c9a277faef2fa commit 1c090bf880bf8879f75e4cd4b93c9a277faef2fa Author: Mark Johnston AuthorDate: 2024-01-11 14:58:31 +0000 Commit: Mark Johnston CommitDate: 2024-01-25 14:57:12 +0000 top: Avoid printing a blank line when the ZFS ARC is empty PR: 275994 MFC after: 2 weeks (cherry picked from commit 1f62718d8ba26d813d8c2e826ac5f4caee4c6730) --- usr.bin/top/machine.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/usr.bin/top/machine.c b/usr.bin/top/machine.c index b4cd29dab878..a76d77a80ce4 100644 --- a/usr.bin/top/machine.c +++ b/usr.bin/top/machine.c @@ -293,17 +293,27 @@ machine_init(struct statics *statics) size = sizeof(carc_en); if (arc_enabled && sysctlbyname("vfs.zfs.compressed_arc_enabled", &carc_en, &size, - NULL, 0) == 0 && carc_en == 1) - carc_enabled = 1; + NULL, 0) == 0 && carc_en == 1) { + uint64_t uncomp_sz; + + /* + * Don't report compression stats if no data is in the ARC. + * Otherwise, we end up printing a blank line. + */ + size = sizeof(uncomp_sz); + if (sysctlbyname("kstat.zfs.misc.arcstats.uncompressed_size", + &uncomp_sz, &size, NULL, 0) == 0 && uncomp_sz != 0) + carc_enabled = 1; + } kd = kvm_open(NULL, _PATH_DEVNULL, NULL, O_RDONLY, "kvm_open"); if (kd == NULL) return (-1); size = sizeof(nswapdev); - if (sysctlbyname("vm.nswapdev", &nswapdev, &size, NULL, - 0) == 0 && nswapdev != 0) - has_swap = 1; + if (sysctlbyname("vm.nswapdev", &nswapdev, &size, NULL, 0) == 0 && + nswapdev != 0) + has_swap = 1; GETSYSCTL("kern.ccpu", ccpu);