mirror of
https://git.proxmox.com/git/pve-installer
synced 2025-04-28 18:36:49 +00:00
run env: always leave 1 GiB for system when clamping ZFS ARC size
To not allow the max ARC size to be the same as the total memory size. Note that 1 GiB is often still not enough for a fully working system, but for one, this can only happen if the user manually overrides ARC max, and for another, it's only a general crude safety net to allow the basic system to boot so that one can correct this if it's a problem as for some products, like PBS or PDM, the base system's RSS usage might be below 1 GiB, and we are not doing product-aware stuff here. Adapt the tests accordingly. Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
31efa29022
commit
91be6a71d5
@ -354,10 +354,13 @@ sub clamp_zfs_arc_max {
|
||||
|
||||
return $mib if $mib == 0;
|
||||
|
||||
my $total_mem_mib = get('total_memory');
|
||||
if ($mib > $total_mem_mib) {
|
||||
return $total_mem_mib;
|
||||
} elsif ($mib < $ZFS_ARC_MIN_SIZE_MIB) {
|
||||
# upper limit is total system memory with a GiB headroom for the base system
|
||||
my $total_mem_with_headroom_mib = get('total_memory') - 1024;
|
||||
if ($mib > $total_mem_with_headroom_mib) {
|
||||
$mib = $total_mem_with_headroom_mib; # do not return directly here, to catch < min ARC size
|
||||
}
|
||||
# lower limit is the ARC min size, else ZFS ignores the setting and uses 50% of total memory again
|
||||
if ($mib < $ZFS_ARC_MIN_SIZE_MIB) {
|
||||
return $ZFS_ARC_MIN_SIZE_MIB;
|
||||
}
|
||||
|
||||
|
@ -61,9 +61,9 @@ my @clamp_tests = (
|
||||
# input, total system memory, expected
|
||||
[ 0, 4 * 1024, 0 ],
|
||||
[ 16, 4 * 1024, 64 ],
|
||||
[ 4 * 1024, 4 * 1024, 4 * 1024 ],
|
||||
[ 4 * 1024, 4 * 1024, 3 * 1024 ],
|
||||
[ 4 * 1024, 6 * 1024, 4 * 1024 ],
|
||||
[ 8 * 1024, 4 * 1024, 4 * 1024 ],
|
||||
[ 8 * 1024, 4 * 1024, 3 * 1024 ],
|
||||
);
|
||||
|
||||
mock_product('pve');
|
||||
|
Loading…
Reference in New Issue
Block a user