Skip to content

Commit

Permalink
Allow zfs_arc_max to survive reboots
Browse files Browse the repository at this point in the history
Turns out Registry read is done before spl init, so
total_memory is not yet set. We will have to trust the
Registry value on boot.

Signed-off-by: Jorgen Lundman <[email protected]>
  • Loading branch information
lundman committed Nov 20, 2024
1 parent 7b984d7 commit 65ae459
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions module/os/windows/zfs/sysctl_os.c
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ sysctl_os_process(PUNICODE_STRING pRegistryPath, ztunable_t *zt)
ULONG len = 0;
ULONG type = 0;

// _CALL style has to 'type', so look it up first.
// _CALL style has to set 'type', so look it up first.
if (zt->zt_perm == ZT_ZMOD_RW) {
char *maybestr = NULL;
ZT_GET_VALUE(zt, (void **)&maybestr, &len,
Expand Down Expand Up @@ -475,15 +475,17 @@ param_set_arc_max(ZFS_MODULE_PARAM_ARGS)

val = *(uint64_t *)(*ptr);

// This can come in so early we have not yet set
// total_memory size. Trust boot Registry value then?
if (val != 0 && (val < MIN_ARC_MAX || val <= arc_c_min ||
val >= arc_all_memory()))
(arc_all_memory() > 0 && val >= arc_all_memory())))
return (SET_ERROR(EINVAL));

zfs_arc_max = val;
arc_tuning_update(B_TRUE);

/* Update the sysctl to the tuned value */
if (val != 0)
if (val != 0 && arc_c_max != 0)
zfs_arc_max = arc_c_max;

return (0);
Expand Down

0 comments on commit 65ae459

Please sign in to comment.