Skip to content

[release-4.22] add KSM and THP tuning opt-ins - #316

Merged
openshift-merge-bot[bot] merged 6 commits into
openshift-virtualization:release-4.22from
tiraboschi:r422_ksm-thp
Aug 19, 2026
Merged

[release-4.22] add KSM and THP tuning opt-ins#316
openshift-merge-bot[bot] merged 6 commits into
openshift-virtualization:release-4.22from
tiraboschi:r422_ksm-thp

Conversation

@tiraboschi

Copy link
Copy Markdown
Member

add opt-in MachineConfigs for KSM zero-only and THP tuning

Two new opt-in features gated on HCO annotations:

ksm-zero-only (platform.kubevirt.io/enable-ksm-zero-only):
Enables KSM in redhat_only_zero_pages mode with adaptive scan rate.
Formula: pages_to_scan=1000, sleep=min(50, 25600/node_gb).
thp-tuning (platform.kubevirt.io/enable-thp-tuning):
Sets THP to madvise and tunes khugepaged for KVM workloads.
Formula: pages_to_scan=130000, sleep=1000+64000/node_gb.
Both deploy a Python script via systemd oneshot that reads node
memory size and writes computed parameters to sysfs at boot.

This is a manual cherry-pick of #288

Signed-off-by: Michal Skrivanek <michal.skrivanek@redhat.com>
Assisted-by: claude-4.6-opus
(cherry picked from commit 4e127b2)
Introduce TemplateParams (map[string]string) on AssetMetadata, passed to
templates as .Params. This allows metadata.yaml to parameterize shared
templates without engine changes per use case.
Add ConditionTypeTopology to gate assets on cluster topology fields
(e.g. hasSchedulableMasters), enabling conditional inclusion of assets
for compact/schedulable-master clusters.

Signed-off-by: Michal Skrivanek <michal.skrivanek@redhat.com>
Assisted-by: claude-4.6-opus
(cherry picked from commit 13ecf25)
Allow assets to be gated on whether an HCO spec field is configured.
When the field is absent, null, or an empty map, the condition evaluates
to true (asset is included). This supports opt-in assets that should
only apply when the user has not explicitly configured the feature in HCO.

Signed-off-by: Michal Skrivanek <michal.skrivanek@redhat.com>
Assisted-by: claude-4.6-opus
(cherry picked from commit 5f4d2cd)
Add KSM zero-pages-only and THP madvise tuning as opt-in MachineConfigs,
gated by annotations and hco-field-unconfigured conditions. Templates use
.Params.role from template_params to support both worker and master roles
from a single shared template. Master variants are conditionally included
via topology hasSchedulableMasters condition.
Includes cluster-monitoring ConfigMap for KSM PrometheusRule.

Signed-off-by: Michal Skrivanek <michal.skrivanek@redhat.com>
Assisted-by: claude-4.6-opus
(cherry picked from commit 2a98741)
Signed-off-by: Michal Skrivanek <michal.skrivanek@redhat.com>
Assisted-by: claude-4.6-opus

(cherry picked from commit 0fbfbda)
Replace static 04-psi-enable.yaml and conditional 05-psi-enable-master.yaml.tpl
with a single shared template using .Params.role. Master variant is now gated
by topology hasSchedulableMasters condition in metadata, consistent with
KSM and THP assets.

Signed-off-by: Michal Skrivanek <michal.skrivanek@redhat.com>
Assisted-by: claude-4.6-opus
(cherry picked from commit 5216dea)
@michalskrivanek

Copy link
Copy Markdown
Contributor

/lgtm

@michalskrivanek

Copy link
Copy Markdown
Contributor

i guess i can't....
/approve

@tiraboschi

Copy link
Copy Markdown
Member Author

/approve

@openshift-ci

openshift-ci Bot commented Aug 19, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: michalskrivanek, tiraboschi

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-bot
openshift-merge-bot Bot merged commit ccd1450 into openshift-virtualization:release-4.22 Aug 19, 2026
6 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants