Skip to content

Commit f474092

Browse files
Alexey Dobriyanbonzini
authored andcommitted
kvm: do not account temporary allocations to kmem
Some allocations done by KVM are temporary, they are created as result of program actions, but can't exists for arbitrary long times. They should have been GFP_TEMPORARY (rip!). OTOH, kvm-nx-lpage-recovery and kvm-pit kernel threads exist for as long as VM exists but their task_struct memory is not accounted. This is story for another day. Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Message-ID: <c0122f66-f428-417e-a360-b25fc0f154a0@p183> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
1 parent b018589 commit f474092

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

virt/kvm/kvm_main.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4427,7 +4427,7 @@ static long kvm_vcpu_ioctl(struct file *filp,
44274427
struct kvm_regs *kvm_regs;
44284428

44294429
r = -ENOMEM;
4430-
kvm_regs = kzalloc(sizeof(struct kvm_regs), GFP_KERNEL_ACCOUNT);
4430+
kvm_regs = kzalloc(sizeof(struct kvm_regs), GFP_KERNEL);
44314431
if (!kvm_regs)
44324432
goto out;
44334433
r = kvm_arch_vcpu_ioctl_get_regs(vcpu, kvm_regs);
@@ -4454,8 +4454,7 @@ static long kvm_vcpu_ioctl(struct file *filp,
44544454
break;
44554455
}
44564456
case KVM_GET_SREGS: {
4457-
kvm_sregs = kzalloc(sizeof(struct kvm_sregs),
4458-
GFP_KERNEL_ACCOUNT);
4457+
kvm_sregs = kzalloc(sizeof(struct kvm_sregs), GFP_KERNEL);
44594458
r = -ENOMEM;
44604459
if (!kvm_sregs)
44614460
goto out;
@@ -4547,7 +4546,7 @@ static long kvm_vcpu_ioctl(struct file *filp,
45474546
break;
45484547
}
45494548
case KVM_GET_FPU: {
4550-
fpu = kzalloc(sizeof(struct kvm_fpu), GFP_KERNEL_ACCOUNT);
4549+
fpu = kzalloc(sizeof(struct kvm_fpu), GFP_KERNEL);
45514550
r = -ENOMEM;
45524551
if (!fpu)
45534552
goto out;
@@ -6210,7 +6209,7 @@ static void kvm_uevent_notify_change(unsigned int type, struct kvm *kvm)
62106209
active = kvm_active_vms;
62116210
mutex_unlock(&kvm_lock);
62126211

6213-
env = kzalloc(sizeof(*env), GFP_KERNEL_ACCOUNT);
6212+
env = kzalloc(sizeof(*env), GFP_KERNEL);
62146213
if (!env)
62156214
return;
62166215

@@ -6226,7 +6225,7 @@ static void kvm_uevent_notify_change(unsigned int type, struct kvm *kvm)
62266225
add_uevent_var(env, "PID=%d", kvm->userspace_pid);
62276226

62286227
if (!IS_ERR(kvm->debugfs_dentry)) {
6229-
char *tmp, *p = kmalloc(PATH_MAX, GFP_KERNEL_ACCOUNT);
6228+
char *tmp, *p = kmalloc(PATH_MAX, GFP_KERNEL);
62306229

62316230
if (p) {
62326231
tmp = dentry_path_raw(kvm->debugfs_dentry, p, PATH_MAX);

0 commit comments

Comments
 (0)