public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH installer 0/4] tui, auto: re-use default zfs arc calculation from run env
@ 2025-02-28  9:43 Christoph Heiss
  2025-02-28  9:43 ` [pve-devel] [PATCH installer 1/4] run env: provide default ZFS ARC maximum size value Christoph Heiss
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Christoph Heiss @ 2025-02-28  9:43 UTC (permalink / raw)
  To: pve-devel

As discovered during the PMG 8.2 release cycle and suggested by Thomas, unify
the ZFS ARC maximum calculation between GUI and TUI.

In short; this series exports the calculated default value for the ZFS ARC
maximum size in the `run-env.json` file. In turn, this is read by common Rust
and can be used from there in the TUI and auto-installer.

Diffstat
========

Christoph Heiss (4):
  run env: provide default ZFS ARC maximum size value
  tui: use default ZFS ARC maximum size from runtime enviroment
  auto: use default ZFS ARC maximum size from runtime enviroment
  gtk, tui: leave 1 GiB headroom for OS in ZFS ARC max size edit view

 Proxmox/Install/RunEnv.pm                     | 10 +++-
 proxinstall                                   |  3 +-
 proxmox-auto-installer/src/utils.rs           |  2 +-
 .../resources/parse_answer/disk_match.toml    |  1 +
 .../parse_answer/disk_match_all.toml          |  1 +
 .../parse_answer/disk_match_any.toml          |  1 +
 .../tests/resources/parse_answer/zfs.toml     |  1 +
 .../zfs_raid_level_uppercase.toml             |  1 +
 .../tests/resources/run-env-info.json         |  2 +-
 proxmox-installer-common/src/options.rs       | 58 +------------------
 proxmox-installer-common/src/setup.rs         |  3 +
 proxmox-tui-installer/src/views/bootdisk.rs   | 48 ++++++---------
 test/zfs-arc-max.pl                           | 12 +---
 13 files changed, 43 insertions(+), 100 deletions(-)

-- 
2.47.1



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [pve-devel] [PATCH installer 1/4] run env: provide default ZFS ARC maximum size value
  2025-02-28  9:43 [pve-devel] [PATCH installer 0/4] tui, auto: re-use default zfs arc calculation from run env Christoph Heiss
@ 2025-02-28  9:43 ` Christoph Heiss
  2025-02-28  9:43 ` [pve-devel] [PATCH installer 2/4] tui: use default ZFS ARC maximum size from runtime enviroment Christoph Heiss
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Christoph Heiss @ 2025-02-28  9:43 UTC (permalink / raw)
  To: pve-devel

This can be then used by the Rust parts directly, without having to
duplicate the calculation.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
---
 Proxmox/Install/RunEnv.pm | 10 +++++++---
 test/zfs-arc-max.pl       | 12 ++----------
 2 files changed, 9 insertions(+), 13 deletions(-)

diff --git a/Proxmox/Install/RunEnv.pm b/Proxmox/Install/RunEnv.pm
index 701343d..407d05c 100644
--- a/Proxmox/Install/RunEnv.pm
+++ b/Proxmox/Install/RunEnv.pm
@@ -238,6 +238,7 @@ my sub detect_country_tracing_to : prototype($$) {
 #     hvm_supported = <1 if the CPU supports hardware-accelerated virtualization>,
 #     secure_boot = <1 if SecureBoot is enabled>,
 #     boot_type = <either 'efi' or 'bios'>,
+#     default_zfs_arc_max => <default upper limit for the ZFS ARC size in MiB>,
 #     disks => <see Proxmox::Sys::Block::hd_list()>,
 #     network => {
 #         interfaces => <see query_netdevs()>,
@@ -285,6 +286,7 @@ sub query_installation_environment : prototype() {
     $output->{total_memory} = query_total_memory();
     $output->{hvm_supported} = query_cpu_hvm_support();
     $output->{boot_type} = -d '/sys/firmware/efi' ? 'efi' : 'bios';
+    $output->{default_zfs_arc_max} = default_zfs_arc_max();
 
     if ($output->{boot_type} eq 'efi') {
 	my $content = eval { file_read_all("/sys/firmware/efi/efivars/SecureBoot-8be4df61-93ca-11d2-aa0d-00e098032b8c") };
@@ -329,9 +331,11 @@ 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.
+# See also <https://bugzilla.proxmox.com/show_bug.cgi?id=4829> and
+# https://openzfs.github.io/openzfs-docs/Performance%20and%20Tuning/Module%20Parameters.html#zfs-arc-max
 sub default_zfs_arc_max {
     my $product = Proxmox::Install::ISOEnv::get('product');
-    my $total_memory = get('total_memory');
+    my $total_memory = query_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.
@@ -340,7 +344,7 @@ sub default_zfs_arc_max {
 	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 $default_mib = $total_memory * $ZFS_ARC_SYSMEM_PERCENTAGE;
     my $rounded_mib = int(sprintf('%.0f', $default_mib));
 
     if ($rounded_mib > $ZFS_ARC_MAX_SIZE_MIB) {
@@ -361,7 +365,7 @@ sub clamp_zfs_arc_max {
     return $mib if $mib == 0;
 
     # upper limit is total system memory with a GiB headroom for the base system
-    my $total_mem_with_headroom_mib = get('total_memory') - 1024;
+    my $total_mem_with_headroom_mib = query_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
     }
diff --git a/test/zfs-arc-max.pl b/test/zfs-arc-max.pl
index 6ae6356..8cf093f 100755
--- a/test/zfs-arc-max.pl
+++ b/test/zfs-arc-max.pl
@@ -33,11 +33,7 @@ my %default_tests = (
 
 while (my ($total_mem, $expected) = each %default_tests) {
     $proxmox_install_runenv->redefine(
-	get => sub {
-	    my ($k) = @_;
-	    return $total_mem if $k eq 'total_memory';
-	    die "runtime environment key $k not mocked!\n";
-	},
+	query_total_memory => sub { return $total_mem; },
     );
 
     mock_product('pve');
@@ -71,11 +67,7 @@ foreach (@clamp_tests) {
     my ($input, $total_mem, $expected) = @$_;
 
     $proxmox_install_runenv->redefine(
-	get => sub {
-	    my ($k) = @_;
-	    return $total_mem if $k eq 'total_memory';
-	    die "runtime environment key $k not mocked!\n";
-	},
+	query_total_memory => sub { return $total_mem; },
     );
 
     is(Proxmox::Install::RunEnv::clamp_zfs_arc_max($input), $expected,
-- 
2.47.1



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [pve-devel] [PATCH installer 2/4] tui: use default ZFS ARC maximum size from runtime enviroment
  2025-02-28  9:43 [pve-devel] [PATCH installer 0/4] tui, auto: re-use default zfs arc calculation from run env Christoph Heiss
  2025-02-28  9:43 ` [pve-devel] [PATCH installer 1/4] run env: provide default ZFS ARC maximum size value Christoph Heiss
@ 2025-02-28  9:43 ` Christoph Heiss
  2025-02-28  9:43 ` [pve-devel] [PATCH installer 3/4] auto: " Christoph Heiss
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Christoph Heiss @ 2025-02-28  9:43 UTC (permalink / raw)
  To: pve-devel

Now that the value is pre-calculated in the low-level installer and
written to `run-env.json`, use it from there instead of calculating it
separately - thus having a single source of truth.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
---
 proxmox-installer-common/src/options.rs     | 58 ++-------------------
 proxmox-installer-common/src/setup.rs       |  3 ++
 proxmox-tui-installer/src/views/bootdisk.rs | 42 ++++++---------
 3 files changed, 21 insertions(+), 82 deletions(-)

diff --git a/proxmox-installer-common/src/options.rs b/proxmox-installer-common/src/options.rs
index 0fd3e43..40100d8 100644
--- a/proxmox-installer-common/src/options.rs
+++ b/proxmox-installer-common/src/options.rs
@@ -6,9 +6,7 @@ use std::str::FromStr;
 use std::sync::OnceLock;
 use std::{cmp, fmt};
 
-use crate::setup::{
-    LocaleInfo, NetworkInfo, ProductConfig, ProxmoxProduct, RuntimeInfo, SetupInfo,
-};
+use crate::setup::{LocaleInfo, NetworkInfo, RuntimeInfo, SetupInfo};
 use crate::utils::{CidrAddress, Fqdn};
 
 #[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
@@ -256,42 +254,20 @@ pub struct ZfsBootdiskOptions {
 
 impl ZfsBootdiskOptions {
     /// Panics if the disk list is empty.
-    pub fn defaults_from(runinfo: &RuntimeInfo, product_conf: &ProductConfig) -> Self {
+    pub fn defaults_from(runinfo: &RuntimeInfo) -> Self {
         let disk = &runinfo.disks[0];
         Self {
             ashift: 12,
             compress: ZfsCompressOption::default(),
             checksum: ZfsChecksumOption::default(),
             copies: 1,
-            arc_max: default_zfs_arc_max(product_conf.product, runinfo.total_memory),
+            arc_max: runinfo.default_zfs_arc_max,
             disk_size: disk.size,
             selected_disks: (0..runinfo.disks.len()).collect(),
         }
     }
 }
 
-/// Calculates the default upper limit for the ZFS ARC size.
-/// See also <https://bugzilla.proxmox.com/show_bug.cgi?id=4829> and
-/// https://openzfs.github.io/openzfs-docs/Performance%20and%20Tuning/Module%20Parameters.html#zfs-arc-max
-///
-/// # Arguments
-/// * `product` - The product to be installed
-/// * `total_memory` - Total memory installed in the system, in MiB
-///
-/// # Returns
-/// The default ZFS maximum ARC size in MiB for this system.
-fn default_zfs_arc_max(product: ProxmoxProduct, total_memory: usize) -> usize {
-    if product != ProxmoxProduct::PVE {
-        // 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.
-        0
-    } else {
-        ((total_memory as f64) / 10.)
-            .round()
-            .clamp(64., 16. * 1024.) as usize
-    }
-}
-
 #[derive(Clone, Debug)]
 pub enum AdvancedBootdiskOptions {
     Lvm(LvmBootdiskOptions),
@@ -493,31 +469,3 @@ pub fn email_validate(email: &str) -> Result<()> {
 
     Ok(())
 }
-
-#[cfg(test)]
-mod tests {
-    use super::*;
-
-    #[test]
-    fn zfs_arc_limit() {
-        const TESTS: &[(usize, usize)] = &[
-            (16, 64), // at least 64 MiB
-            (1024, 102),
-            (4 * 1024, 410),
-            (8 * 1024, 819),
-            (150 * 1024, 15360),
-            (160 * 1024, 16384),
-            (1024 * 1024, 16384), // maximum of 16 GiB
-        ];
-
-        for (total_memory, expected) in TESTS {
-            assert_eq!(
-                default_zfs_arc_max(ProxmoxProduct::PVE, *total_memory),
-                *expected
-            );
-            assert_eq!(default_zfs_arc_max(ProxmoxProduct::PBS, *total_memory), 0);
-            assert_eq!(default_zfs_arc_max(ProxmoxProduct::PMG, *total_memory), 0);
-            assert_eq!(default_zfs_arc_max(ProxmoxProduct::PDM, *total_memory), 0);
-        }
-    }
-}
diff --git a/proxmox-installer-common/src/setup.rs b/proxmox-installer-common/src/setup.rs
index 93818f3..6b033e1 100644
--- a/proxmox-installer-common/src/setup.rs
+++ b/proxmox-installer-common/src/setup.rs
@@ -390,6 +390,9 @@ pub struct RuntimeInfo {
     /// Whether the system was booted with SecureBoot enabled
     #[serde(default, deserialize_with = "deserialize_bool_from_int_maybe")]
     pub secure_boot: Option<bool>,
+
+    /// Default upper limit for the ZFS ARC size, in MiB.
+    pub default_zfs_arc_max: usize,
 }
 
 #[derive(Copy, Clone, Eq, Deserialize, PartialEq, Serialize)]
diff --git a/proxmox-tui-installer/src/views/bootdisk.rs b/proxmox-tui-installer/src/views/bootdisk.rs
index fffb05e..2e2019d 100644
--- a/proxmox-tui-installer/src/views/bootdisk.rs
+++ b/proxmox-tui-installer/src/views/bootdisk.rs
@@ -162,7 +162,7 @@ impl AdvancedBootdiskOptionsView {
                 &product_conf,
             )),
             AdvancedBootdiskOptions::Zfs(zfs) => {
-                view.add_child(ZfsBootdiskOptionsView::new(runinfo, zfs, &product_conf))
+                view.add_child(ZfsBootdiskOptionsView::new(runinfo, zfs))
             }
             AdvancedBootdiskOptions::Btrfs(btrfs) => {
                 view.add_child(BtrfsBootdiskOptionsView::new(runinfo, btrfs))
@@ -213,10 +213,9 @@ impl AdvancedBootdiskOptionsView {
                             &product_conf,
                         ))
                     }
-                    FsType::Zfs(_) => view.add_child(ZfsBootdiskOptionsView::new_with_defaults(
-                        &runinfo,
-                        &product_conf,
-                    )),
+                    FsType::Zfs(_) => {
+                        view.add_child(ZfsBootdiskOptionsView::new_with_defaults(&runinfo))
+                    }
                     FsType::Btrfs(_) => {
                         view.add_child(BtrfsBootdiskOptionsView::new_with_defaults(&runinfo))
                     }
@@ -631,27 +630,20 @@ struct ZfsBootdiskOptionsView {
 
 impl ZfsBootdiskOptionsView {
     // TODO: Re-apply previous disk selection from `options` correctly
-    fn new(
-        runinfo: &RuntimeInfo,
-        options: &ZfsBootdiskOptions,
-        product_conf: &ProductConfig,
-    ) -> Self {
+    fn new(runinfo: &RuntimeInfo, options: &ZfsBootdiskOptions) -> Self {
         let arc_max_view = {
             let view = IntegerEditView::new_with_suffix("MiB").max_value(runinfo.total_memory);
 
-            // For PVE "force" the default value, for other products place the recommended value
-            // only in the placeholder. This causes for the latter to not write the module option
-            // if the value is never modified by the user.
-            if product_conf.product == ProxmoxProduct::PVE {
+            // If the runtime environment provides a non-zero value, that is
+            // also not the built-in ZFS default of half the system memory, use
+            // that as default.
+            // Otherwise, just place the ZFS default into the placeholder.
+            if runinfo.default_zfs_arc_max > 0
+                && runinfo.default_zfs_arc_max != runinfo.total_memory / 2
+            {
                 view.content(options.arc_max)
             } else {
-                let view = view.placeholder(runinfo.total_memory / 2);
-
-                if options.arc_max != 0 {
-                    view.content(options.arc_max)
-                } else {
-                    view
-                }
+                view.placeholder(runinfo.total_memory / 2)
             }
         };
 
@@ -696,12 +688,8 @@ impl ZfsBootdiskOptionsView {
         Self { view }
     }
 
-    fn new_with_defaults(runinfo: &RuntimeInfo, product_conf: &ProductConfig) -> Self {
-        Self::new(
-            runinfo,
-            &ZfsBootdiskOptions::defaults_from(runinfo, product_conf),
-            product_conf,
-        )
+    fn new_with_defaults(runinfo: &RuntimeInfo) -> Self {
+        Self::new(runinfo, &ZfsBootdiskOptions::defaults_from(runinfo))
     }
 
     fn get_values(&mut self) -> Option<(Vec<Disk>, ZfsBootdiskOptions)> {
-- 
2.47.1



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [pve-devel] [PATCH installer 3/4] auto: use default ZFS ARC maximum size from runtime enviroment
  2025-02-28  9:43 [pve-devel] [PATCH installer 0/4] tui, auto: re-use default zfs arc calculation from run env Christoph Heiss
  2025-02-28  9:43 ` [pve-devel] [PATCH installer 1/4] run env: provide default ZFS ARC maximum size value Christoph Heiss
  2025-02-28  9:43 ` [pve-devel] [PATCH installer 2/4] tui: use default ZFS ARC maximum size from runtime enviroment Christoph Heiss
@ 2025-02-28  9:43 ` Christoph Heiss
  2025-02-28  9:43 ` [pve-devel] [PATCH installer 4/4] gtk, tui: leave 1 GiB headroom for OS in ZFS ARC max size edit view Christoph Heiss
  2025-04-04  8:49 ` [pve-devel] applied-series: [PATCH installer 0/4] tui, auto: re-use default zfs arc calculation from run env Thomas Lamprecht
  4 siblings, 0 replies; 6+ messages in thread
From: Christoph Heiss @ 2025-02-28  9:43 UTC (permalink / raw)
  To: pve-devel

Now that the value is pre-calculated in the low-level installer and
written to `run-env.json`, use it from there instead of calculating it
separately - thus having a single source of truth.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
---
 proxmox-auto-installer/src/utils.rs                             | 2 +-
 .../tests/resources/parse_answer/disk_match.toml                | 1 +
 .../tests/resources/parse_answer/disk_match_all.toml            | 1 +
 .../tests/resources/parse_answer/disk_match_any.toml            | 1 +
 proxmox-auto-installer/tests/resources/parse_answer/zfs.toml    | 1 +
 .../tests/resources/parse_answer/zfs_raid_level_uppercase.toml  | 1 +
 proxmox-auto-installer/tests/resources/run-env-info.json        | 2 +-
 7 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/proxmox-auto-installer/src/utils.rs b/proxmox-auto-installer/src/utils.rs
index 44e0749..f159614 100644
--- a/proxmox-auto-installer/src/utils.rs
+++ b/proxmox-auto-installer/src/utils.rs
@@ -451,7 +451,7 @@ pub fn parse_answer(
                 .unwrap_or(runtime_info.disks[first_selected_disk].size);
             config.zfs_opts = Some(InstallZfsOption {
                 ashift: zfs.ashift.unwrap_or(12),
-                arc_max: zfs.arc_max.unwrap_or(2048),
+                arc_max: zfs.arc_max.unwrap_or(runtime_info.default_zfs_arc_max),
                 compress: zfs.compress.unwrap_or(ZfsCompressOption::On),
                 checksum: zfs.checksum.unwrap_or(ZfsChecksumOption::On),
                 copies: zfs.copies.unwrap_or(1),
diff --git a/proxmox-auto-installer/tests/resources/parse_answer/disk_match.toml b/proxmox-auto-installer/tests/resources/parse_answer/disk_match.toml
index 5177eb2..0351f5c 100644
--- a/proxmox-auto-installer/tests/resources/parse_answer/disk_match.toml
+++ b/proxmox-auto-installer/tests/resources/parse_answer/disk_match.toml
@@ -12,5 +12,6 @@ source = "from-dhcp"
 [disk-setup]
 filesystem = "zfs"
 zfs.raid = "raid10"
+zfs.arc_max = 2048
 #disk_list = ['sda']
 filter.ID_SERIAL = "*MZ7KM240HAGR*"
diff --git a/proxmox-auto-installer/tests/resources/parse_answer/disk_match_all.toml b/proxmox-auto-installer/tests/resources/parse_answer/disk_match_all.toml
index 60daa54..ed38d20 100644
--- a/proxmox-auto-installer/tests/resources/parse_answer/disk_match_all.toml
+++ b/proxmox-auto-installer/tests/resources/parse_answer/disk_match_all.toml
@@ -12,6 +12,7 @@ source = "from-dhcp"
 [disk-setup]
 filesystem = "zfs"
 zfs.raid = "raid0"
+zfs.arc_max = 2048
 filter_match = "all"
 filter.ID_SERIAL = "*MZ7KM240HAGR*"
 filter.ID_SERIAL_SHORT = "S2HRNX0J403419"
diff --git a/proxmox-auto-installer/tests/resources/parse_answer/disk_match_any.toml b/proxmox-auto-installer/tests/resources/parse_answer/disk_match_any.toml
index 6e45c5b..8bd8b86 100644
--- a/proxmox-auto-installer/tests/resources/parse_answer/disk_match_any.toml
+++ b/proxmox-auto-installer/tests/resources/parse_answer/disk_match_any.toml
@@ -12,6 +12,7 @@ source = "from-dhcp"
 [disk-setup]
 filesystem = "zfs"
 zfs.raid = "raid10"
+zfs.arc_max = 2048
 filter_match = "any"
 filter.ID_SERIAL = "*MZ7KM240HAGR*"
 filter.ID_MODEL = "Micron_9300*"
diff --git a/proxmox-auto-installer/tests/resources/parse_answer/zfs.toml b/proxmox-auto-installer/tests/resources/parse_answer/zfs.toml
index 369fd63..971b463 100644
--- a/proxmox-auto-installer/tests/resources/parse_answer/zfs.toml
+++ b/proxmox-auto-installer/tests/resources/parse_answer/zfs.toml
@@ -17,4 +17,5 @@ zfs.checksum = "on"
 zfs.compress = "lz4"
 zfs.copies = 2
 zfs.hdsize = 80
+zfs.arc_max = 2048
 disk_list = ["sda", "sdb"]
diff --git a/proxmox-auto-installer/tests/resources/parse_answer/zfs_raid_level_uppercase.toml b/proxmox-auto-installer/tests/resources/parse_answer/zfs_raid_level_uppercase.toml
index a1a2c64..0b0d6cb 100644
--- a/proxmox-auto-installer/tests/resources/parse_answer/zfs_raid_level_uppercase.toml
+++ b/proxmox-auto-installer/tests/resources/parse_answer/zfs_raid_level_uppercase.toml
@@ -13,3 +13,4 @@ source = "from-dhcp"
 filesystem = "zfs"
 disk_list = ["sda", "sdb", "sdc"]
 zfs.raid = "RAIDZ-1"
+zfs.arc_max = 2048
diff --git a/proxmox-auto-installer/tests/resources/run-env-info.json b/proxmox-auto-installer/tests/resources/run-env-info.json
index 6762470..9a74cdf 100644
--- a/proxmox-auto-installer/tests/resources/run-env-info.json
+++ b/proxmox-auto-installer/tests/resources/run-env-info.json
@@ -1 +1 @@
-{"boot_type":"efi","country":"at","disks":[[0,"/dev/nvme0n1",6251233968,"Micron_9300_MTFDHAL3T2TDR",4096,"/sys/block/nvme0n1"],[1,"/dev/nvme1n1",6251233968,"Micron_9300_MTFDHAL3T2TDR",4096,"/sys/block/nvme1n1"],[2,"/dev/nvme2n1",6251233968,"Micron_9300_MTFDHAL3T2TDR",4096,"/sys/block/nvme2n1"],[3,"/dev/nvme3n1",6251233968,"Micron_9300_MTFDHAL3T2TDR",4096,"/sys/block/nvme3n1"],[4,"/dev/nvme4n1",976773168,"Samsung SSD 970 EVO Plus 500GB",512,"/sys/block/nvme4n1"],[5,"/dev/nvme5n1",732585168,"INTEL SSDPED1K375GA",512,"/sys/block/nvme5n1"],[6,"/dev/sda",468862128,"SAMSUNG MZ7KM240",512,"/sys/block/sda"],[7,"/dev/sdb",468862128,"SAMSUNG MZ7KM240",512,"/sys/block/sdb"],[8,"/dev/sdc",468862128,"SAMSUNG MZ7KM240",512,"/sys/block/sdc"],[9,"/dev/sdd",468862128,"SAMSUNG MZ7KM240",512,"/sys/block/sdd"]],"hvm_supported":1,"ipconf":{"default":"4","dnsserver":"192.168.1.254","domain":null,"gateway":"192.168.1.1","ifaces":{"10":{"driver":"mlx5_core","flags":"NO-CARRIER,BROADCAST,MULTICAST,UP","mac"
 :"24:8a:07:1e:05:bd","name":"enp193s0f1np1","state":"DOWN"},"2":{"driver":"igb","flags":"NO-CARRIER,BROADCAST,MULTICAST,UP","mac":"a0:36:9f:0a:b3:82","name":"enp65s0f0","state":"DOWN"},"3":{"driver":"igb","flags":"NO-CARRIER,BROADCAST,MULTICAST,UP","mac":"a0:36:9f:0a:b3:83","name":"enp65s0f1","state":"DOWN"},"4":{"driver":"igb","flags":"BROADCAST,MULTICAST,UP,LOWER_UP","inet":{"addr":"192.168.1.114","mask":"255.255.240.0","prefix":20},"mac":"b4:2e:99:ac:ad:b4","name":"eno1","state":"UP"},"5":{"driver":"cdc_ether","flags":"BROADCAST,MULTICAST,UP,LOWER_UP","mac":"5a:47:32:dd:c7:47","name":"enx5a4732ddc747","state":"UNKNOWN"},"6":{"driver":"igb","flags":"BROADCAST,MULTICAST,UP,LOWER_UP","mac":"b4:2e:99:ac:ad:b5","name":"eno2","state":"UP"},"7":{"driver":"mlx5_core","flags":"NO-CARRIER,BROADCAST,MULTICAST,UP","mac":"1c:34:da:5c:5e:24","name":"enp129s0f0np0","state":"DOWN"},"8":{"driver":"mlx5_core","flags":"NO-CARRIER,BROADCAST,MULTICAST,UP","mac":"1c:34:da:5c:5e:25","name":"enp129s0f1n
 p1","state":"DOWN"},"9":{"driver":"mlx5_core","flags":"BROADCAST,MULTICAST,UP,LOWER_UP","mac":"24:8a:07:1e:05:bc","name":"enp193s0f0np0","state":"UP"}}},"kernel_cmdline":"BOOT_IMAGE=/boot/linux26 ro ramdisk_size=16777216 rw splash=verbose proxdebug vga=788","network":{"dns":{"dns":["192.168.1.254"],"domain":null},"interfaces":{"eno1":{"addresses":[{"address":"192.168.1.114","family":"inet","prefix":24}],"index":4,"mac":"b4:2e:99:ac:ad:b4","name":"eno1","state":"UP"},"eno2":{"index":6,"mac":"b4:2e:99:ac:ad:b5","name":"eno2","state":"UP"},"enp129s0f0np0":{"index":7,"mac":"1c:34:da:5c:5e:24","name":"enp129s0f0np0","state":"DOWN"},"enp129s0f1np1":{"index":8,"mac":"1c:34:da:5c:5e:25","name":"enp129s0f1np1","state":"DOWN"},"enp193s0f0np0":{"index":9,"mac":"24:8a:07:1e:05:bc","name":"enp193s0f0np0","state":"UP"},"enp193s0f1np1":{"index":10,"mac":"24:8a:07:1e:05:bd","name":"enp193s0f1np1","state":"DOWN"},"enp65s0f0":{"index":2,"mac":"a0:36:9f:0a:b3:82","name":"enp65s0f0","state":"DOWN"},"en
 p65s0f1":{"index":3,"mac":"a0:36:9f:0a:b3:83","name":"enp65s0f1","state":"DOWN"},"enx5a4732ddc747":{"index":5,"mac":"5a:47:32:dd:c7:47","name":"enx5a4732ddc747","state":"UNKNOWN"}},"routes":{"gateway4":{"dev":"eno1","gateway":"192.168.1.1"}}},"total_memory":257597}
+{"boot_type":"efi","country":"at","disks":[[0,"/dev/nvme0n1",6251233968,"Micron_9300_MTFDHAL3T2TDR",4096,"/sys/block/nvme0n1"],[1,"/dev/nvme1n1",6251233968,"Micron_9300_MTFDHAL3T2TDR",4096,"/sys/block/nvme1n1"],[2,"/dev/nvme2n1",6251233968,"Micron_9300_MTFDHAL3T2TDR",4096,"/sys/block/nvme2n1"],[3,"/dev/nvme3n1",6251233968,"Micron_9300_MTFDHAL3T2TDR",4096,"/sys/block/nvme3n1"],[4,"/dev/nvme4n1",976773168,"Samsung SSD 970 EVO Plus 500GB",512,"/sys/block/nvme4n1"],[5,"/dev/nvme5n1",732585168,"INTEL SSDPED1K375GA",512,"/sys/block/nvme5n1"],[6,"/dev/sda",468862128,"SAMSUNG MZ7KM240",512,"/sys/block/sda"],[7,"/dev/sdb",468862128,"SAMSUNG MZ7KM240",512,"/sys/block/sdb"],[8,"/dev/sdc",468862128,"SAMSUNG MZ7KM240",512,"/sys/block/sdc"],[9,"/dev/sdd",468862128,"SAMSUNG MZ7KM240",512,"/sys/block/sdd"]],"hvm_supported":1,"ipconf":{"default":"4","dnsserver":"192.168.1.254","domain":null,"gateway":"192.168.1.1","ifaces":{"10":{"driver":"mlx5_core","flags":"NO-CARRIER,BROADCAST,MULTICAST,UP","mac"
 :"24:8a:07:1e:05:bd","name":"enp193s0f1np1","state":"DOWN"},"2":{"driver":"igb","flags":"NO-CARRIER,BROADCAST,MULTICAST,UP","mac":"a0:36:9f:0a:b3:82","name":"enp65s0f0","state":"DOWN"},"3":{"driver":"igb","flags":"NO-CARRIER,BROADCAST,MULTICAST,UP","mac":"a0:36:9f:0a:b3:83","name":"enp65s0f1","state":"DOWN"},"4":{"driver":"igb","flags":"BROADCAST,MULTICAST,UP,LOWER_UP","inet":{"addr":"192.168.1.114","mask":"255.255.240.0","prefix":20},"mac":"b4:2e:99:ac:ad:b4","name":"eno1","state":"UP"},"5":{"driver":"cdc_ether","flags":"BROADCAST,MULTICAST,UP,LOWER_UP","mac":"5a:47:32:dd:c7:47","name":"enx5a4732ddc747","state":"UNKNOWN"},"6":{"driver":"igb","flags":"BROADCAST,MULTICAST,UP,LOWER_UP","mac":"b4:2e:99:ac:ad:b5","name":"eno2","state":"UP"},"7":{"driver":"mlx5_core","flags":"NO-CARRIER,BROADCAST,MULTICAST,UP","mac":"1c:34:da:5c:5e:24","name":"enp129s0f0np0","state":"DOWN"},"8":{"driver":"mlx5_core","flags":"NO-CARRIER,BROADCAST,MULTICAST,UP","mac":"1c:34:da:5c:5e:25","name":"enp129s0f1n
 p1","state":"DOWN"},"9":{"driver":"mlx5_core","flags":"BROADCAST,MULTICAST,UP,LOWER_UP","mac":"24:8a:07:1e:05:bc","name":"enp193s0f0np0","state":"UP"}}},"kernel_cmdline":"BOOT_IMAGE=/boot/linux26 ro ramdisk_size=16777216 rw splash=verbose proxdebug vga=788","network":{"dns":{"dns":["192.168.1.254"],"domain":null},"interfaces":{"eno1":{"addresses":[{"address":"192.168.1.114","family":"inet","prefix":24}],"index":4,"mac":"b4:2e:99:ac:ad:b4","name":"eno1","state":"UP"},"eno2":{"index":6,"mac":"b4:2e:99:ac:ad:b5","name":"eno2","state":"UP"},"enp129s0f0np0":{"index":7,"mac":"1c:34:da:5c:5e:24","name":"enp129s0f0np0","state":"DOWN"},"enp129s0f1np1":{"index":8,"mac":"1c:34:da:5c:5e:25","name":"enp129s0f1np1","state":"DOWN"},"enp193s0f0np0":{"index":9,"mac":"24:8a:07:1e:05:bc","name":"enp193s0f0np0","state":"UP"},"enp193s0f1np1":{"index":10,"mac":"24:8a:07:1e:05:bd","name":"enp193s0f1np1","state":"DOWN"},"enp65s0f0":{"index":2,"mac":"a0:36:9f:0a:b3:82","name":"enp65s0f0","state":"DOWN"},"en
 p65s0f1":{"index":3,"mac":"a0:36:9f:0a:b3:83","name":"enp65s0f1","state":"DOWN"},"enx5a4732ddc747":{"index":5,"mac":"5a:47:32:dd:c7:47","name":"enx5a4732ddc747","state":"UNKNOWN"}},"routes":{"gateway4":{"dev":"eno1","gateway":"192.168.1.1"}}},"total_memory":257597,"default_zfs_arc_max":128798}
-- 
2.47.1



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [pve-devel] [PATCH installer 4/4] gtk, tui: leave 1 GiB headroom for OS in ZFS ARC max size edit view
  2025-02-28  9:43 [pve-devel] [PATCH installer 0/4] tui, auto: re-use default zfs arc calculation from run env Christoph Heiss
                   ` (2 preceding siblings ...)
  2025-02-28  9:43 ` [pve-devel] [PATCH installer 3/4] auto: " Christoph Heiss
@ 2025-02-28  9:43 ` Christoph Heiss
  2025-04-04  8:49 ` [pve-devel] applied-series: [PATCH installer 0/4] tui, auto: re-use default zfs arc calculation from run env Thomas Lamprecht
  4 siblings, 0 replies; 6+ messages in thread
From: Christoph Heiss @ 2025-02-28  9:43 UTC (permalink / raw)
  To: pve-devel

We always want to leave a little bit of extra headroom
for the OS.

This follows commit 91be6a7 [0], which adjusts the clamp calculation.
Reflect that here in the user-facing UI as well.

[0] https://git.proxmox.com/?p=pve-installer.git;a=commitdiff;h=91be6a7

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
---
 proxinstall                                 | 3 ++-
 proxmox-tui-installer/src/views/bootdisk.rs | 4 +++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/proxinstall b/proxinstall
index fe7e29f..2101f0a 100755
--- a/proxinstall
+++ b/proxinstall
@@ -1159,9 +1159,10 @@ my $create_raid_advanced_grid = sub {
     my $total_memory = Proxmox::Install::RunEnv::get('total_memory');
     my $arc_max = Proxmox::Install::Config::get_zfs_opt('arc_max') || ($total_memory * 0.5);
 
+    # always leave a GiB as headroom for the OS
     my $arc_max_adjustment = Gtk3::Adjustment->new(
 	$arc_max, $Proxmox::Install::RunEnv::ZFS_ARC_MIN_SIZE_MIB,
-	$total_memory, 1, 10, 0);
+	$total_memory - 1024, 1, 10, 0);
     my $spinbutton_arc_max = Gtk3::SpinButton->new($arc_max_adjustment, 1, 0);
     $spinbutton_arc_max->set_tooltip_text('Maximum ARC size in megabytes');
     $spinbutton_arc_max->signal_connect('value-changed' => sub {
diff --git a/proxmox-tui-installer/src/views/bootdisk.rs b/proxmox-tui-installer/src/views/bootdisk.rs
index 2e2019d..c8b3ef3 100644
--- a/proxmox-tui-installer/src/views/bootdisk.rs
+++ b/proxmox-tui-installer/src/views/bootdisk.rs
@@ -632,7 +632,9 @@ impl ZfsBootdiskOptionsView {
     // TODO: Re-apply previous disk selection from `options` correctly
     fn new(runinfo: &RuntimeInfo, options: &ZfsBootdiskOptions) -> Self {
         let arc_max_view = {
-            let view = IntegerEditView::new_with_suffix("MiB").max_value(runinfo.total_memory);
+            // Always leave a GiB of headroom for the OS.
+            let view =
+                IntegerEditView::new_with_suffix("MiB").max_value(runinfo.total_memory - 1024);
 
             // If the runtime environment provides a non-zero value, that is
             // also not the built-in ZFS default of half the system memory, use
-- 
2.47.1



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [pve-devel] applied-series:  [PATCH installer 0/4] tui, auto: re-use default zfs arc calculation from run env
  2025-02-28  9:43 [pve-devel] [PATCH installer 0/4] tui, auto: re-use default zfs arc calculation from run env Christoph Heiss
                   ` (3 preceding siblings ...)
  2025-02-28  9:43 ` [pve-devel] [PATCH installer 4/4] gtk, tui: leave 1 GiB headroom for OS in ZFS ARC max size edit view Christoph Heiss
@ 2025-04-04  8:49 ` Thomas Lamprecht
  4 siblings, 0 replies; 6+ messages in thread
From: Thomas Lamprecht @ 2025-04-04  8:49 UTC (permalink / raw)
  To: Proxmox VE development discussion, Christoph Heiss

Am 28.02.25 um 10:43 schrieb Christoph Heiss:
> As discovered during the PMG 8.2 release cycle and suggested by Thomas, unify
> the ZFS ARC maximum calculation between GUI and TUI.
> 
> In short; this series exports the calculated default value for the ZFS ARC
> maximum size in the `run-env.json` file. In turn, this is read by common Rust
> and can be used from there in the TUI and auto-installer.
> 
> Diffstat
> ========
> 
> Christoph Heiss (4):
>   run env: provide default ZFS ARC maximum size value
>   tui: use default ZFS ARC maximum size from runtime enviroment
>   auto: use default ZFS ARC maximum size from runtime enviroment
>   gtk, tui: leave 1 GiB headroom for OS in ZFS ARC max size edit view
> 
>  Proxmox/Install/RunEnv.pm                     | 10 +++-
>  proxinstall                                   |  3 +-
>  proxmox-auto-installer/src/utils.rs           |  2 +-
>  .../resources/parse_answer/disk_match.toml    |  1 +
>  .../parse_answer/disk_match_all.toml          |  1 +
>  .../parse_answer/disk_match_any.toml          |  1 +
>  .../tests/resources/parse_answer/zfs.toml     |  1 +
>  .../zfs_raid_level_uppercase.toml             |  1 +
>  .../tests/resources/run-env-info.json         |  2 +-
>  proxmox-installer-common/src/options.rs       | 58 +------------------
>  proxmox-installer-common/src/setup.rs         |  3 +
>  proxmox-tui-installer/src/views/bootdisk.rs   | 48 ++++++---------
>  test/zfs-arc-max.pl                           | 12 +---
>  13 files changed, 43 insertions(+), 100 deletions(-)
> 


applied series, had to workaround the garbled diff from patch 3/4 due to mail length
limits, thanks!, luckily one can just edit the patch in .git/rebase-apply/0001 and
use git apply and git am --continue to fix this locally.


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-04-04  8:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-02-28  9:43 [pve-devel] [PATCH installer 0/4] tui, auto: re-use default zfs arc calculation from run env Christoph Heiss
2025-02-28  9:43 ` [pve-devel] [PATCH installer 1/4] run env: provide default ZFS ARC maximum size value Christoph Heiss
2025-02-28  9:43 ` [pve-devel] [PATCH installer 2/4] tui: use default ZFS ARC maximum size from runtime enviroment Christoph Heiss
2025-02-28  9:43 ` [pve-devel] [PATCH installer 3/4] auto: " Christoph Heiss
2025-02-28  9:43 ` [pve-devel] [PATCH installer 4/4] gtk, tui: leave 1 GiB headroom for OS in ZFS ARC max size edit view Christoph Heiss
2025-04-04  8:49 ` [pve-devel] applied-series: [PATCH installer 0/4] tui, auto: re-use default zfs arc calculation from run env Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal