Skip to content

Commit dd10340

Browse files
flying-122sean-jc
authored andcommitted
KVM: X86: Remove unnecessary GFP_KERNEL_ACCOUNT for temporary variables
Some variables allocated in kvm_arch_vcpu_ioctl are released when the function exits, so there is no need to set GFP_KERNEL_ACCOUNT. Signed-off-by: Peng Hao <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Sean Christopherson <[email protected]>
1 parent 8815d77 commit dd10340

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

arch/x86/kvm/x86.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5884,8 +5884,7 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
58845884
r = -EINVAL;
58855885
if (!lapic_in_kernel(vcpu))
58865886
goto out;
5887-
u.lapic = kzalloc(sizeof(struct kvm_lapic_state),
5888-
GFP_KERNEL_ACCOUNT);
5887+
u.lapic = kzalloc(sizeof(struct kvm_lapic_state), GFP_KERNEL);
58895888

58905889
r = -ENOMEM;
58915890
if (!u.lapic)
@@ -6078,7 +6077,7 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
60786077
if (vcpu->arch.guest_fpu.uabi_size > sizeof(struct kvm_xsave))
60796078
break;
60806079

6081-
u.xsave = kzalloc(sizeof(struct kvm_xsave), GFP_KERNEL_ACCOUNT);
6080+
u.xsave = kzalloc(sizeof(struct kvm_xsave), GFP_KERNEL);
60826081
r = -ENOMEM;
60836082
if (!u.xsave)
60846083
break;
@@ -6109,7 +6108,7 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
61096108
case KVM_GET_XSAVE2: {
61106109
int size = vcpu->arch.guest_fpu.uabi_size;
61116110

6112-
u.xsave = kzalloc(size, GFP_KERNEL_ACCOUNT);
6111+
u.xsave = kzalloc(size, GFP_KERNEL);
61136112
r = -ENOMEM;
61146113
if (!u.xsave)
61156114
break;
@@ -6127,7 +6126,7 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
61276126
}
61286127

61296128
case KVM_GET_XCRS: {
6130-
u.xcrs = kzalloc(sizeof(struct kvm_xcrs), GFP_KERNEL_ACCOUNT);
6129+
u.xcrs = kzalloc(sizeof(struct kvm_xcrs), GFP_KERNEL);
61316130
r = -ENOMEM;
61326131
if (!u.xcrs)
61336132
break;

0 commit comments

Comments
 (0)