[mm][RFC][PATCH 4/11] mm accessor for kvm

KAMEZAWA Hiroyuki
2009-12-16T03:08:23Z

Use mm_accessor in /kvm layer.

Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
---
security/tomoyo/common.c | 4 ++--
virt/kvm/kvm_main.c | 6 +++---
2 files changed, 5 insertions(+), 5 deletions(-)

Index: mmotm-mm-accessor/virt/kvm/kvm_main.c
===================================================================
--- mmotm-mm-accessor.orig/virt/kvm/kvm_main.c
+++ mmotm-mm-accessor/virt/kvm/kvm_main.c
@@ -843,18 +843,18 @@ pfn_t gfn_to_pfn(struct kvm *kvm, gfn_t
if (unlikely(npages != 1)) {
struct vm_area_struct *vma;

- down_read(&current->mm->mmap_sem);
+ mm_read_lock(current->mm);
vma = find_vma(current->mm, addr);

if (vma == NULL || addr < vma->vm_start ||
!(vma->vm_flags & VM_PFNMAP)) {
- up_read(&current->mm->mmap_sem);
+ mm_read_unlock(current->mm);
get_page(bad_page);
return page_to_pfn(bad_page);
}

pfn = ((addr - vma->vm_start) >> PAGE_SHIFT) + vma->vm_pgoff;
- up_read(&current->mm->mmap_sem);
+ mm_read_unlock(current->mm);
BUG_ON(!kvm_is_mmio_pfn(pfn));
} else
pfn = page_to_pfn(page[0]);