Commit f474092c authored by Alexey Dobriyan's avatar Alexey Dobriyan Committed by Paolo Bonzini

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: default avatarAlexey Dobriyan <adobriyan@gmail.com>
Message-ID: <c0122f66-f428-417e-a360-b25fc0f154a0@p183>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent b0185890
...@@ -4427,7 +4427,7 @@ static long kvm_vcpu_ioctl(struct file *filp, ...@@ -4427,7 +4427,7 @@ static long kvm_vcpu_ioctl(struct file *filp,
struct kvm_regs *kvm_regs; struct kvm_regs *kvm_regs;
r = -ENOMEM; r = -ENOMEM;
kvm_regs = kzalloc(sizeof(struct kvm_regs), GFP_KERNEL_ACCOUNT); kvm_regs = kzalloc(sizeof(struct kvm_regs), GFP_KERNEL);
if (!kvm_regs) if (!kvm_regs)
goto out; goto out;
r = kvm_arch_vcpu_ioctl_get_regs(vcpu, kvm_regs); r = kvm_arch_vcpu_ioctl_get_regs(vcpu, kvm_regs);
...@@ -4454,8 +4454,7 @@ static long kvm_vcpu_ioctl(struct file *filp, ...@@ -4454,8 +4454,7 @@ static long kvm_vcpu_ioctl(struct file *filp,
break; break;
} }
case KVM_GET_SREGS: { case KVM_GET_SREGS: {
kvm_sregs = kzalloc(sizeof(struct kvm_sregs), kvm_sregs = kzalloc(sizeof(struct kvm_sregs), GFP_KERNEL);
GFP_KERNEL_ACCOUNT);
r = -ENOMEM; r = -ENOMEM;
if (!kvm_sregs) if (!kvm_sregs)
goto out; goto out;
...@@ -4547,7 +4546,7 @@ static long kvm_vcpu_ioctl(struct file *filp, ...@@ -4547,7 +4546,7 @@ static long kvm_vcpu_ioctl(struct file *filp,
break; break;
} }
case KVM_GET_FPU: { case KVM_GET_FPU: {
fpu = kzalloc(sizeof(struct kvm_fpu), GFP_KERNEL_ACCOUNT); fpu = kzalloc(sizeof(struct kvm_fpu), GFP_KERNEL);
r = -ENOMEM; r = -ENOMEM;
if (!fpu) if (!fpu)
goto out; goto out;
...@@ -6210,7 +6209,7 @@ static void kvm_uevent_notify_change(unsigned int type, struct kvm *kvm) ...@@ -6210,7 +6209,7 @@ static void kvm_uevent_notify_change(unsigned int type, struct kvm *kvm)
active = kvm_active_vms; active = kvm_active_vms;
mutex_unlock(&kvm_lock); mutex_unlock(&kvm_lock);
env = kzalloc(sizeof(*env), GFP_KERNEL_ACCOUNT); env = kzalloc(sizeof(*env), GFP_KERNEL);
if (!env) if (!env)
return; return;
...@@ -6226,7 +6225,7 @@ static void kvm_uevent_notify_change(unsigned int type, struct kvm *kvm) ...@@ -6226,7 +6225,7 @@ static void kvm_uevent_notify_change(unsigned int type, struct kvm *kvm)
add_uevent_var(env, "PID=%d", kvm->userspace_pid); add_uevent_var(env, "PID=%d", kvm->userspace_pid);
if (!IS_ERR(kvm->debugfs_dentry)) { if (!IS_ERR(kvm->debugfs_dentry)) {
char *tmp, *p = kmalloc(PATH_MAX, GFP_KERNEL_ACCOUNT); char *tmp, *p = kmalloc(PATH_MAX, GFP_KERNEL);
if (p) { if (p) {
tmp = dentry_path_raw(kvm->debugfs_dentry, p, PATH_MAX); tmp = dentry_path_raw(kvm->debugfs_dentry, p, PATH_MAX);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment