From d85fc52b409dc4007ab848388c3e096eec85268d Mon Sep 17 00:00:00 2001 From: Bjoern Brandenburg Date: Mon, 25 Jun 2012 09:25:25 +0200 Subject: control page: use vm_insert_page() instead of remap_pfn_range() vm_insert_page() is the simpler and preferred interface for remapping individual pages and includes additional error checks. It suffices for our purposes, so let's use it instead. --- litmus/ctrldev.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) (limited to 'litmus') diff --git a/litmus/ctrldev.c b/litmus/ctrldev.c index 6677a67cc945..294d134a4a6d 100644 --- a/litmus/ctrldev.c +++ b/litmus/ctrldev.c @@ -30,27 +30,19 @@ static int alloc_ctrl_page(struct task_struct *t) static int map_ctrl_page(struct task_struct *t, struct vm_area_struct* vma) { int err; - unsigned long pfn; struct page* ctrl = virt_to_page(tsk_rt(t)->ctrl_page); - /* Increase ref count. Is decreased when vma is destroyed. */ - get_page(ctrl); - - /* compute page frame number */ - pfn = page_to_pfn(ctrl); - TRACE_CUR(CTRL_NAME - ": mapping %p (pfn:%lx, %lx) to 0x%lx (prot:%lx)\n", - tsk_rt(t)->ctrl_page, pfn, page_to_pfn(ctrl), vma->vm_start, + ": mapping %p (pfn:%lx) to 0x%lx (prot:%lx)\n", + tsk_rt(t)->ctrl_page,page_to_pfn(ctrl), vma->vm_start, vma->vm_page_prot); - /* Map it into the vma. Make sure to use PAGE_SHARED, otherwise - * userspace actually gets a copy-on-write page. */ - err = remap_pfn_range(vma, vma->vm_start, pfn, PAGE_SIZE, PAGE_SHARED); + /* Map it into the vma. */ + err = vm_insert_page(vma, vma->vm_start, ctrl); if (err) - TRACE_CUR(CTRL_NAME ": remap_pfn_range() failed (%d)\n", err); + TRACE_CUR(CTRL_NAME ": vm_insert_page() failed (%d)\n", err); return err; } -- cgit v1.2.2