Skip to content

Commit

Permalink
x86/kvm: Don't waste memory if kvmclock is disabled
Browse files Browse the repository at this point in the history
Even if "no-kvmclock" is passed in cmdline parameter, the guest kernel
still allocates hvclock_mem which is scaled by the number of vCPUs,
let's check kvmclock enable in advance to avoid this memory waste.

Signed-off-by: Wanpeng Li <wanpengli@tencent.com>
Message-Id: <1645520523-30814-1-git-send-email-wanpengli@tencent.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
  • Loading branch information
Wanpeng Li authored and Paolo Bonzini committed Feb 25, 2022
1 parent 40cd58d commit 3c51d0a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions arch/x86/kernel/kvmclock.c
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,9 @@ static void __init kvmclock_init_mem(void)

static int __init kvm_setup_vsyscall_timeinfo(void)
{
if (!kvmclock)
return 0;

kvmclock_init_mem();

#ifdef CONFIG_X86_64
Expand Down

0 comments on commit 3c51d0a

Please sign in to comment.