Skip to content

Commit 3c51d0a

Browse files
Wanpeng Libonzini
authored andcommitted
x86/kvm: Don't waste memory if kvmclock is disabled
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 <[email protected]> Message-Id: <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent 40cd58d commit 3c51d0a

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

arch/x86/kernel/kvmclock.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,9 @@ static void __init kvmclock_init_mem(void)
239239

240240
static int __init kvm_setup_vsyscall_timeinfo(void)
241241
{
242+
if (!kvmclock)
243+
return 0;
244+
242245
kvmclock_init_mem();
243246

244247
#ifdef CONFIG_X86_64

0 commit comments

Comments
 (0)