Page 1 of 1

BUG: zsysctl.conf gets wrongly set

PostPosted: Mon Jan 02, 2023 7:21 am
by mike0810
I use the following zsysctl.conf:
Code: Select all
# Uses the standard SYSCTL.CONF(5) format.
# Comments are denoted by a "#" at the beginning of a line.

# It is highly recommended to put a date and justification as comments
# alongside each tuning.

# The zfs_arc_max parameter is in bytes and accepts decimal or
# hexadecimal values. The following text shows how to set this parameter
# to 11 GB, as an example:

# 10 Mar 2015; ilovezfs
# Cap the ARC to 11 GB reserving 5 GB for applications.
# 11 * 2^30 = 11,811,160,064
kstat.zfs.darwin.tunable.zfs_arc.max=11811160064

# As another example, let's raise the zfs_arc_meta_limit:

# 10 Mar 2015; ilovezfs
# Raise zfs_arc_meta_limit to 3/4 (instead of 1/4) of zfs_arc_max.
# 3/4 * (11 * 2^30) = 8,858,370,048
# But let's use hexadecimal this time.
# 8,858,370,048 = 0x210000000
kstat.zfs.darwin.tunable.zfs_arc.meta_limit=8858370048


When I look into the /var/log/org.openzfsonosx.zpool-import-all.log, the following gets set:
Code: Select all
Mon Jan  2 16:16:54 CET 2023
Waiting up to 60 seconds for the InvariantDisks idle file /var/run/disk/invariant.idle to exist
Found /var/run/disk/invariant.idle after 0 iterations of sleeping 0.1 seconds
Mon Jan  2 16:17:06 CET 2023
kstat.zfs.darwin.tunable.zfs_arc.max: 0
kstat.zfs.darwin.tunable.zfs_arc.meta_limit: 0 -> 268435456
Mon Jan  2 16:17:06 CET 2023
-zpool-import-all.sh
Loading and starting org.openzfsonosx.zpool-import
Mon Jan  2 16:17:16 CET 2023
Status: 0
Touching the file /var/run/org.openzfsonosx.zpool-import-all.didRun
Mon Jan  2 16:17:16 CET 2023

This setting gets ignored completely:
kstat.zfs.darwin.tunable.zfs_arc.max: 0
This one to a very low amount:
kstat.zfs.darwin.tunable.zfs_arc.meta_limit: 0 -> 268435456

Also in the package installer, no recent zsysctl.conf example gets installed, nor is it part of the installer.

Thats what the output looks like which is strange because there is a blank and 0 at the end of the meta_limit parameter:
sysctl kstat.zfs.darwin.tunable.zfs_arc.max
kstat.zfs.darwin.tunable.zfs_arc.max: 0
sysctl kstat.zfs.darwin.tunable.zfs_arc.meta_limit
kstat.zfs.darwin.tunable.zfs_arc.meta_limit: 268435456 0

Re: zsysctl.conf gets wrongly set

PostPosted: Mon Jan 02, 2023 7:31 am
by mike0810
Applying it manually gives me the following output:

sudo /usr/local/zfs/bin/zsysctl -f /etc/zfs/zsysctl.conf
kstat.zfs.darwin.tunable.zfs_arc.max: 0
zsysctl: kstat.zfs.darwin.tunable.zfs_arc.max: Invalid argument
kstat.zfs.darwin.tunable.zfs_arc.meta_limit: 268435456 -> 268435456

But the old kernel parameter kstat.zfs.darwin.tunable.zfs_arc_max does not work as well

Re: BUG: zsysctl.conf gets wrongly set

PostPosted: Wed Feb 15, 2023 6:42 pm
by lundman
I have confirmed both these issues, and fixed with:

https://github.com/openzfsonosx/openzfs ... 386df0d663
https://github.com/openzfsonosx/openzfs ... b20ac3b14f

Code: Select all
# sysctl kstat.zfs.darwin.tunable.zfs_arc.max=2013265919
kstat.zfs.darwin.tunable.zfs_arc.max: 0 -> 2013265919
(small VM)

sysctl kstat.zfs.darwin.tunable.zfs_arc.meta_limit=8858370048   
kstat.zfs.darwin.tunable.zfs_arc.meta_limit: 8858370048 -> 8858370048
SPL: Warning: ignoring tunable zfs_arc_meta_limit (using 1509949440 instead)
(small VM)


Re: BUG: zsysctl.conf gets wrongly set

PostPosted: Sat Mar 04, 2023 7:43 am
by mike0810
Great! Thank you!