Skip to content

Commit

Permalink
FreeBSD: Skip RAW kstat sysctls by default
Browse files Browse the repository at this point in the history
These kstats are often expensive to compute so we want to avoid them
unless specifically requested.

The following kstats are affected by this change:

kstat.zfs.${pool}.multihost
kstat.zfs.${pool}.misc.state
kstat.zfs.${pool}.txgs
kstat.zfs.misc.fletcher_4_bench
kstat.zfs.misc.vdev_raidz_bench
kstat.zfs.misc.dbufs
kstat.zfs.misc.dbgmsg

In FreeBSD 13, sysctl(8) has been updated to still list the
names/description/type of skipped sysctls so they are still
discoverable.

Reviewed-by: Allan Jude <allan@klarasystems.com>
Reviewed-by: Mateusz Guzik <mjguzik@gmail.com>
Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
Closes openzfs#11099
  • Loading branch information
Ryan Moeller authored and Ryan Moeller committed Oct 30, 2020
1 parent 99048c0 commit 3c25153
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions module/os/freebsd/spl/spl_kstat.c
Original file line number Diff line number Diff line change
Expand Up @@ -475,14 +475,14 @@ kstat_install(kstat_t *ksp)
if (ksp->ks_raw_ops.data) {
root = SYSCTL_ADD_PROC(&ksp->ks_sysctl_ctx,
SYSCTL_CHILDREN(ksp->ks_sysctl_root),
OID_AUTO, ksp->ks_name,
CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE,
OID_AUTO, ksp->ks_name, CTLTYPE_STRING | CTLFLAG_RD
| CTLFLAG_MPSAFE | CTLFLAG_SKIP,
ksp, 0, kstat_sysctl_raw, "A", ksp->ks_name);
} else {
root = SYSCTL_ADD_PROC(&ksp->ks_sysctl_ctx,
SYSCTL_CHILDREN(ksp->ks_sysctl_root),
OID_AUTO, ksp->ks_name,
CTLTYPE_OPAQUE | CTLFLAG_RD | CTLFLAG_MPSAFE,
OID_AUTO, ksp->ks_name, CTLTYPE_OPAQUE | CTLFLAG_RD
| CTLFLAG_MPSAFE | CTLFLAG_SKIP,
ksp, 0, kstat_sysctl_raw, "", ksp->ks_name);
}
break;
Expand Down

0 comments on commit 3c25153

Please sign in to comment.