From nobody Thu Jan 25 15:03:04 2024 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 4TLPG03SDwz57QXG; Thu, 25 Jan 2024 15:03:04 +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 4TLPG0326Vz4q88; Thu, 25 Jan 2024 15:03:04 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1706194984; 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=Rgn4prWIxne8r9YDS8XnF/chn+3R8Qzt5r2O18GWIlY=; b=xU0CouqKtAdqL/xGW8KLNk6R0ncPcO1z99fRM4MLEse/250J2cD2I0xpC8YC7/6AMZpm3g 6L0FdU2TzFf4dSQx7r+j3bnUAtxVmkKeFI/KksIv7/1XAdiLnSSKym+SrqRWg3xJXDg1F/ b/0nbOh1VSvAmwLHKEiLllOTpR9J+kTQ5P0B/n4O7wSX30661DnnYngzUZAIn/WH/zV/Qy Td/BUeJHC0JyaS+gu47vRBEUJFmtIW+raBiVtU6w1D6zxdLHHW1CSZvnqhpEX58EPV9DV8 7PMUR1bt6caw3MRioOqnLu9BJJx6n9mdxSaA37yL5R5Wwy/jAqb5TeuO44nm3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1706194984; 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=Rgn4prWIxne8r9YDS8XnF/chn+3R8Qzt5r2O18GWIlY=; b=CA/oOCsAoKfAJV/XUXnnUf/B8Tt+hZC8OZKO+8ZURStyLwmZfiIAZ9k2WjYfaj7+XSEiaq 410d3dLowXxvywy9uDT675CyKrDSmnwbYHyouYw9AGXTT9M5ck4lP7cDndZPD2nkPPcVgQ OSv0EB2fUEAT6DqyyGtIlPQ5l7dox/N1C4OJ/gFdfZbG4tzOkjJEPoNJCnocR+WMSI6gLi Mb/tM3ueaMDry3jTjIFsNdUX86GoNzIuScgJGIgIK/dyLQ1EsY0J1IAXMU3/LIyQuWTW40 Aq0d2p6qOoJsmEqEeT5z5FVJeQCLNQ0QBfdBtvT7Ii0574Zawoyh323wYgD/oQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1706194984; a=rsa-sha256; cv=none; b=k2annLd217tsvmQ8tDQ1Gt3isT8m/mm1DNPKe/LkUFZb9gLfuopnmlbf0EP5n0wZFv7FPT G7Y3NmBozMR2FD3Jzci4+b9hjHqony7D/0q1HGxIWXRypbQJ1Jr3p+zl4U/gCJX84HIH45 Drx4bFHgjH+I+L8Qe0k8kNvPwoEtvIHdRtc0FeUokChSykxGQ6v0I8uMZDmxZmDAX2IV9Y 3ZXnQCmsUPmO8lR+WmED4Yg9SGyB+KxeuvbQVuNOZxQKn75nEdJsc2QXaOMQ5z3lZwJYhd 8/witgUzpKiPq0jtr9sQi+feVqEJNMnIG8LCpzLMbhGCNpLI62f9u970xylCsg== 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 4TLPG0264Hz12yZ; Thu, 25 Jan 2024 15:03:04 +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 40PF34iu057365; Thu, 25 Jan 2024 15:03:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 40PF34ck057362; Thu, 25 Jan 2024 15:03:04 GMT (envelope-from git) Date: Thu, 25 Jan 2024 15:03:04 GMT Message-Id: <202401251503.40PF34ck057362@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: f4524aff6d66 - stable/13 - top: Avoid printing a blank line when the ZFS ARC is empty 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=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: f4524aff6d66edbfb7b3f184118b0a4299c4b1af Auto-Submitted: auto-generated The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=f4524aff6d66edbfb7b3f184118b0a4299c4b1af commit f4524aff6d66edbfb7b3f184118b0a4299c4b1af Author: Mark Johnston AuthorDate: 2024-01-11 14:58:31 +0000 Commit: Mark Johnston CommitDate: 2024-01-25 14:58:44 +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);