]> git.ipfire.org Git - thirdparty/linux.git/commit
KVM: Mark halt poll and other module parameters with appropriate memory attributes
authorLi RongQing <lirongqing@baidu.com>
Tue, 10 Feb 2026 06:21:43 +0000 (01:21 -0500)
committerSean Christopherson <seanjc@google.com>
Mon, 2 Mar 2026 22:32:29 +0000 (14:32 -0800)
commit46ee9d718b9b67a8be067a39e21da6634107ed0e
tree0d6e70cb10c1fb9385bdd24ae8443848d7336dad
parentc522ac04ba9d7ec6003633aa1501c7392cdf8b2d
KVM: Mark halt poll and other module parameters with appropriate memory attributes

Add '__read_mostly' to the halt polling parameters (halt_poll_ns,
halt_poll_ns_grow, halt_poll_ns_grow_start, halt_poll_ns_shrink) since
they are frequently read in hot paths (e.g., vCPU halt handling) but only
occasionally updated via sysfs. This improves cache locality on SMP
systems.

Conversely, mark 'allow_unsafe_mappings' and 'enable_virt_at_load' with
'__ro_after_init', as they are set only during module initialization via
kernel command line or early sysfs writes and remain constant thereafter.
This enhances security by preventing runtime modification and enables
compiler optimizations.

Signed-off-by: Li RongQing <lirongqing@baidu.com>
Link: https://patch.msgid.link/20260210062143.1739-1-lirongqing@baidu.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
virt/kvm/kvm_main.c