Skip to content

Commit 1448d4a

Browse files
tobluxsean-jc
authored andcommitted
KVM: x86: Optimize local variable in start_sw_tscdeadline()
Change the data type of the local variable this_tsc_khz to u32 because virtual_tsc_khz is also declared as u32. Since do_div() casts the divisor to u32 anyway, changing the data type of this_tsc_khz to u32 also removes the following Coccinelle/coccicheck warning reported by do_div.cocci: WARNING: do_div() does a 64-by-32 division, please consider using div64_ul instead Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com> Link: https://lore.kernel.org/r/20240814203345.2234-2-thorsten.blum@toblux.com Signed-off-by: Sean Christopherson <seanjc@google.com>
1 parent 47ac09b commit 1448d4a

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

arch/x86/kvm/lapic.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1944,7 +1944,7 @@ static void start_sw_tscdeadline(struct kvm_lapic *apic)
19441944
u64 ns = 0;
19451945
ktime_t expire;
19461946
struct kvm_vcpu *vcpu = apic->vcpu;
1947-
unsigned long this_tsc_khz = vcpu->arch.virtual_tsc_khz;
1947+
u32 this_tsc_khz = vcpu->arch.virtual_tsc_khz;
19481948
unsigned long flags;
19491949
ktime_t now;
19501950

0 commit comments

Comments
 (0)