1
0
Fork 0

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
This commit is contained in:
Pavol Žáčik 2025-07-08 10:13:04 +02:00
parent 1c746a35a2
commit 096c402881
No known key found for this signature in database
GPG key ID: B3029C97EB97E3E4
14 changed files with 28 additions and 21 deletions

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -27,7 +27,7 @@ spindown=6
alpm=medium_power
[vm]
dirty_ratio=60
dirty_bytes=60%
[sysctl]
vm.dirty_writeback_centisecs=6000

View file

@ -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]

View file

@ -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

View file

@ -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

View file

@ -2,4 +2,4 @@
summary=Post-loaded profile that uses variables from the regular active profile
[vm]
dirty_ratio=${foo}
dirty_bytes=${foo}%

View file

@ -2,4 +2,4 @@
summary=Post-loaded profile
[vm]
dirty_ratio=8
dirty_bytes=8%

View file

@ -2,4 +2,4 @@
summary=Second version of the post-loaded profile
[vm]
dirty_ratio=7
dirty_bytes=7%

View file

@ -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: