diff --git a/Proxmox/Install/RunEnv.pm b/Proxmox/Install/RunEnv.pm index 5e8a6c2..701343d 100644 --- a/Proxmox/Install/RunEnv.pm +++ b/Proxmox/Install/RunEnv.pm @@ -330,9 +330,15 @@ our $ZFS_ARC_SYSMEM_PERCENTAGE = 0.1; # use 10% of available system memory by de # Calculates the default upper limit for the ZFS ARC size. # Returns the default ZFS maximum ARC size in MiB. sub default_zfs_arc_max { - # For products other the PVE, just let ZFS decide on its own. Setting `0` - # causes the installer to skip writing the `zfs_arc_max` module parameter. - return 0 if Proxmox::Install::ISOEnv::get('product') ne 'pve'; + my $product = Proxmox::Install::ISOEnv::get('product'); + my $total_memory = get('total_memory'); + + # By default limit PVE and low-memory systems, for all others let ZFS decide on its own by + # returning `0`, which causes the installer to skip writing the `zfs_arc_max` module parameter. + if ($product ne 'pve') { + return 0 if $total_memory >= 2048 && $product ne 'pmg'; + return 0 if $total_memory >= 4096; # PMG's base memory requirement is much higer + } my $default_mib = get('total_memory') * $ZFS_ARC_SYSMEM_PERCENTAGE; my $rounded_mib = int(sprintf('%.0f', $default_mib)); diff --git a/test/zfs-arc-max.pl b/test/zfs-arc-max.pl index 401469e..6ae6356 100755 --- a/test/zfs-arc-max.pl +++ b/test/zfs-arc-max.pl @@ -45,15 +45,15 @@ while (my ($total_mem, $expected) = each %default_tests) { "$expected MiB should be zfs_arc_max for PVE with $total_mem MiB system memory"); mock_product('pbs'); - is(Proxmox::Install::RunEnv::default_zfs_arc_max(), 0, + is(Proxmox::Install::RunEnv::default_zfs_arc_max(), $total_mem < 2048 ? $expected : 0, "zfs_arc_max should default to `0` for PBS with $total_mem MiB system memory"); mock_product('pmg'); - is(Proxmox::Install::RunEnv::default_zfs_arc_max(), 0, + is(Proxmox::Install::RunEnv::default_zfs_arc_max(), $total_mem < 4096 ? $expected : 0, "zfs_arc_max should default to `0` for PMG with $total_mem MiB system memory"); mock_product('pdm'); - is(Proxmox::Install::RunEnv::default_zfs_arc_max(), 0, + is(Proxmox::Install::RunEnv::default_zfs_arc_max(), $total_mem < 2048 ? $expected : 0, "zfs_arc_max should default to `0` for PDM with $total_mem MiB system memory"); }