diff options
author | Alexander Graf <agraf@suse.de> | 2010-02-19 06:24:33 -0500 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2010-04-25 05:38:04 -0400 |
commit | 032c3407310c7612db55ab7e1335a21dc2b4690d (patch) | |
tree | 34235b63019986c9d6e49452ef289c6432d59417 /arch/powerpc/kvm/book3s.c | |
parent | 964b6411af10fbddc827fdd3887c49f7f5d2bfd3 (diff) |
KVM: PPC: Allocate vcpu struct using vmalloc
We used to use get_free_pages to allocate our vcpu struct. Unfortunately
that call failed on me several times after my machine had a big enough
uptime, as memory became too fragmented by then.
Fortunately, we don't need it to be page aligned any more! We can just
vmalloc it and everything's great.
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/powerpc/kvm/book3s.c')
-rw-r--r-- | arch/powerpc/kvm/book3s.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/arch/powerpc/kvm/book3s.c b/arch/powerpc/kvm/book3s.c index 0446c5a39ae2..6758ec80f902 100644 --- a/arch/powerpc/kvm/book3s.c +++ b/arch/powerpc/kvm/book3s.c | |||
@@ -1112,8 +1112,7 @@ struct kvm_vcpu *kvmppc_core_vcpu_create(struct kvm *kvm, unsigned int id) | |||
1112 | struct kvm_vcpu *vcpu; | 1112 | struct kvm_vcpu *vcpu; |
1113 | int err; | 1113 | int err; |
1114 | 1114 | ||
1115 | vcpu_book3s = (struct kvmppc_vcpu_book3s *)__get_free_pages( GFP_KERNEL | __GFP_ZERO, | 1115 | vcpu_book3s = vmalloc(sizeof(struct kvmppc_vcpu_book3s)); |
1116 | get_order(sizeof(struct kvmppc_vcpu_book3s))); | ||
1117 | if (!vcpu_book3s) { | 1116 | if (!vcpu_book3s) { |
1118 | err = -ENOMEM; | 1117 | err = -ENOMEM; |
1119 | goto out; | 1118 | goto out; |
@@ -1151,7 +1150,7 @@ struct kvm_vcpu *kvmppc_core_vcpu_create(struct kvm *kvm, unsigned int id) | |||
1151 | return vcpu; | 1150 | return vcpu; |
1152 | 1151 | ||
1153 | free_vcpu: | 1152 | free_vcpu: |
1154 | free_pages((long)vcpu_book3s, get_order(sizeof(struct kvmppc_vcpu_book3s))); | 1153 | vfree(vcpu_book3s); |
1155 | out: | 1154 | out: |
1156 | return ERR_PTR(err); | 1155 | return ERR_PTR(err); |
1157 | } | 1156 | } |
@@ -1162,7 +1161,7 @@ void kvmppc_core_vcpu_free(struct kvm_vcpu *vcpu) | |||
1162 | 1161 | ||
1163 | __destroy_context(vcpu_book3s->context_id); | 1162 | __destroy_context(vcpu_book3s->context_id); |
1164 | kvm_vcpu_uninit(vcpu); | 1163 | kvm_vcpu_uninit(vcpu); |
1165 | free_pages((long)vcpu_book3s, get_order(sizeof(struct kvmppc_vcpu_book3s))); | 1164 | vfree(vcpu_book3s); |
1166 | } | 1165 | } |
1167 | 1166 | ||
1168 | extern int __kvmppc_vcpu_entry(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu); | 1167 | extern int __kvmppc_vcpu_entry(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu); |