From 096c402881da3c1f35ec881ae2ed4145a366fd87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavol=20=C5=BD=C3=A1=C4=8Dik?= Date: Tue, 8 Jul 2025 10:13:04 +0200 Subject: [PATCH] vm: Deprecate dirty_ratio in favour of dirty_bytes with % Same for dirty_background_ratio and dirty_background_bytes. Using both the ratio and the bytes is not compatible with the current profile inheritance implementation, because it is not possible for dirty_bytes in a child profile to override dirty_ratio in its parent profile. Resolves: RHEL-101578 --- profiles/accelerator-performance/tuned.conf | 4 ++-- profiles/latency-performance/tuned.conf | 4 ++-- profiles/mssql/tuned.conf | 4 ++-- profiles/oracle/tuned.conf | 4 ++-- profiles/sap-hana/tuned.conf | 4 ++-- profiles/spectrumscale-ece/tuned.conf | 4 ++-- profiles/spindown-disk/tuned.conf | 2 +- profiles/throughput-performance/tuned.conf | 4 ++-- profiles/virtual-guest/tuned.conf | 2 +- profiles/virtual-host/tuned.conf | 2 +- .../post-vars/tuned.conf | 2 +- .../post/tuned.conf | 2 +- .../post2/tuned.conf | 2 +- tuned/plugins/plugin_vm.py | 9 ++++++++- 14 files changed, 28 insertions(+), 21 deletions(-) diff --git a/profiles/accelerator-performance/tuned.conf b/profiles/accelerator-performance/tuned.conf index 01f1a78..c844212 100644 --- a/profiles/accelerator-performance/tuned.conf +++ b/profiles/accelerator-performance/tuned.conf @@ -25,11 +25,11 @@ readahead=>4096 # # The generator of dirty data starts writeback at this percentage (system default # is 20%) -dirty_ratio = 40 +dirty_bytes = 40% # Start background writeback (via writeback threads) at this percentage (system # default is 10%) -dirty_background_ratio = 10 +dirty_background_bytes = 10% [sysctl] # PID allocation wrap value. When the kernel's next PID value diff --git a/profiles/latency-performance/tuned.conf b/profiles/latency-performance/tuned.conf index 1e044f5..ec683dd 100644 --- a/profiles/latency-performance/tuned.conf +++ b/profiles/latency-performance/tuned.conf @@ -22,11 +22,11 @@ platform_profile=performance # # The generator of dirty data starts writeback at this percentage (system default # is 20%) -dirty_ratio=10 +dirty_bytes=10% # Start background writeback (via writeback threads) at this percentage (system # default is 10%) -dirty_background_ratio=3 +dirty_background_bytes=3% [sysctl] # The swappiness parameter controls the tendency of the kernel to move diff --git a/profiles/mssql/tuned.conf b/profiles/mssql/tuned.conf index cf3e0f9..435fd0c 100644 --- a/profiles/mssql/tuned.conf +++ b/profiles/mssql/tuned.conf @@ -12,8 +12,8 @@ force_latency=5 [vm] # For multi-instance SQL deployments use 'madvise' instead of 'always' transparent_hugepages=always -dirty_background_ratio=3 -dirty_ratio=80 +dirty_background_bytes=3% +dirty_bytes=80% [sysctl] vm.swappiness=1 diff --git a/profiles/oracle/tuned.conf b/profiles/oracle/tuned.conf index a1673ff..8beac62 100644 --- a/profiles/oracle/tuned.conf +++ b/profiles/oracle/tuned.conf @@ -25,6 +25,6 @@ kernel.panic_on_oops = 1 kernel.numa_balancing = 0 [vm] -dirty_background_ratio = 3 -dirty_ratio = 40 +dirty_background_bytes = 3% +dirty_bytes = 40% transparent_hugepages=never diff --git a/profiles/sap-hana/tuned.conf b/profiles/sap-hana/tuned.conf index 02089bb..80cebe0 100644 --- a/profiles/sap-hana/tuned.conf +++ b/profiles/sap-hana/tuned.conf @@ -13,8 +13,8 @@ min_perf_pct=100 [vm] transparent_hugepages=madvise -dirty_ratio = 40 -dirty_background_ratio = 10 +dirty_bytes = 40% +dirty_background_bytes = 10% [sysctl] kernel.sem = 32000 1024000000 500 32000 diff --git a/profiles/spectrumscale-ece/tuned.conf b/profiles/spectrumscale-ece/tuned.conf index 3b3beba..0bbaeff 100644 --- a/profiles/spectrumscale-ece/tuned.conf +++ b/profiles/spectrumscale-ece/tuned.conf @@ -12,8 +12,8 @@ energy_perf_bias=performance min_perf_pct=100 [vm] -dirty_ratio = 40 -dirty_background_ratio = 10 +dirty_bytes = 40% +dirty_background_bytes = 10% [sysctl] kernel.numa_balancing = 1 diff --git a/profiles/spindown-disk/tuned.conf b/profiles/spindown-disk/tuned.conf index 5252bb7..2228de2 100644 --- a/profiles/spindown-disk/tuned.conf +++ b/profiles/spindown-disk/tuned.conf @@ -27,7 +27,7 @@ spindown=6 alpm=medium_power [vm] -dirty_ratio=60 +dirty_bytes=60% [sysctl] vm.dirty_writeback_centisecs=6000 diff --git a/profiles/throughput-performance/tuned.conf b/profiles/throughput-performance/tuned.conf index b55989c..bfe54b4 100644 --- a/profiles/throughput-performance/tuned.conf +++ b/profiles/throughput-performance/tuned.conf @@ -25,11 +25,11 @@ platform_profile=performance # # The generator of dirty data starts writeback at this percentage (system default # is 20%) -dirty_ratio = 40 +dirty_bytes = 40% # Start background writeback (via writeback threads) at this percentage (system # default is 10%) -dirty_background_ratio = 10 +dirty_background_bytes = 10% # Marvell ThunderX [vm.thunderx] diff --git a/profiles/virtual-guest/tuned.conf b/profiles/virtual-guest/tuned.conf index bc4c039..e7bc2ec 100644 --- a/profiles/virtual-guest/tuned.conf +++ b/profiles/virtual-guest/tuned.conf @@ -14,7 +14,7 @@ include=throughput-performance # # The generator of dirty data starts writeback at this percentage (system default # is 20%) -dirty_ratio = 30 +dirty_bytes = 30% [sysctl] # Filesystem I/O is usually much more efficient than swapping, so try to keep diff --git a/profiles/virtual-host/tuned.conf b/profiles/virtual-host/tuned.conf index ba58cbb..6cb5228 100644 --- a/profiles/virtual-host/tuned.conf +++ b/profiles/virtual-host/tuned.conf @@ -9,7 +9,7 @@ include=throughput-performance [vm] # Start background writeback (via writeback threads) at this percentage (system # default is 10%) -dirty_background_ratio = 5 +dirty_background_bytes = 5% [cpu] # Setting C3 state sleep mode/power savings diff --git a/tests/beakerlib/bz1798183-RFE-support-post-loaded-profile/post-vars/tuned.conf b/tests/beakerlib/bz1798183-RFE-support-post-loaded-profile/post-vars/tuned.conf index a93de04..d217ebe 100644 --- a/tests/beakerlib/bz1798183-RFE-support-post-loaded-profile/post-vars/tuned.conf +++ b/tests/beakerlib/bz1798183-RFE-support-post-loaded-profile/post-vars/tuned.conf @@ -2,4 +2,4 @@ summary=Post-loaded profile that uses variables from the regular active profile [vm] -dirty_ratio=${foo} +dirty_bytes=${foo}% diff --git a/tests/beakerlib/bz1798183-RFE-support-post-loaded-profile/post/tuned.conf b/tests/beakerlib/bz1798183-RFE-support-post-loaded-profile/post/tuned.conf index de0629f..f68adeb 100644 --- a/tests/beakerlib/bz1798183-RFE-support-post-loaded-profile/post/tuned.conf +++ b/tests/beakerlib/bz1798183-RFE-support-post-loaded-profile/post/tuned.conf @@ -2,4 +2,4 @@ summary=Post-loaded profile [vm] -dirty_ratio=8 +dirty_bytes=8% diff --git a/tests/beakerlib/bz1798183-RFE-support-post-loaded-profile/post2/tuned.conf b/tests/beakerlib/bz1798183-RFE-support-post-loaded-profile/post2/tuned.conf index c8fedd9..b7c3057 100644 --- a/tests/beakerlib/bz1798183-RFE-support-post-loaded-profile/post2/tuned.conf +++ b/tests/beakerlib/bz1798183-RFE-support-post-loaded-profile/post2/tuned.conf @@ -2,4 +2,4 @@ summary=Second version of the post-loaded profile [vm] -dirty_ratio=7 +dirty_bytes=7% diff --git a/tuned/plugins/plugin_vm.py b/tuned/plugins/plugin_vm.py index 8e4beae..a74425e 100644 --- a/tuned/plugins/plugin_vm.py +++ b/tuned/plugins/plugin_vm.py @@ -53,7 +53,7 @@ class VMPlugin(base.Plugin): @staticmethod def _check_conflicting_dirty_options(instance, first, second): if instance.options[first] is not None and instance.options[second] is not None: - log.error("Conflicting options '%s' and '%s', this may cause undefined behavior." % (first, second)) + log.warning("Conflicting options '%s' and '%s', this may cause undefined behavior." % (first, second)) @staticmethod def _proc_sys_vm_option_path(option): @@ -160,18 +160,24 @@ class VMPlugin(base.Plugin): @command_custom("dirty_bytes") def _dirty_bytes(self, enabling, value, verify, ignore_missing, instance): + if value is not None and value.strip().endswith("%"): + return self._dirty_option("dirty_ratio", "dirty_bytes", self._check_ratio, enabling, value.strip().rstrip("%"), verify) return self._dirty_option("dirty_bytes", "dirty_ratio", self._check_twice_pagesize, enabling, value, verify) @command_custom("dirty_ratio") def _dirty_ratio(self, enabling, value, verify, ignore_missing, instance): + log.warning("The 'dirty_ratio' option is deprecated and does not support inheritance, use 'dirty_bytes' with '%' instead.") return self._dirty_option("dirty_ratio", "dirty_bytes", self._check_ratio, enabling, value, verify) @command_custom("dirty_background_bytes") def _dirty_background_bytes(self, enabling, value, verify, ignore_missing, instance): + if value is not None and value.strip().endswith("%"): + return self._dirty_option("dirty_background_ratio", "dirty_background_bytes", self._check_ratio, enabling, value.strip().rstrip("%"), verify) return self._dirty_option("dirty_background_bytes", "dirty_background_ratio", self._check_positive, enabling, value, verify) @command_custom("dirty_background_ratio") def _dirty_background_ratio(self, enabling, value, verify, ignore_missing, instance): + log.warning("The 'dirty_background_ratio' option is deprecated and does not support inheritance, use 'dirty_background_bytes' with '%' instead.") return self._dirty_option("dirty_background_ratio", "dirty_background_bytes", self._check_ratio, enabling, value, verify) def _dirty_option(self, option, counterpart, check_fun, enabling, value, verify): @@ -189,6 +195,7 @@ class VMPlugin(base.Plugin): int_value = int(value) except ValueError: log.error("The value of '%s' must be an integer." % option) + return None if not check_fun(option, int_value): return None if current_value == value: