aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-03-29 14:43:30 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-03-29 14:43:30 -0400
commiteefbab599531240adaffa1d23900afbc8b0342bd (patch)
tree2beb38a94aca40c7e5a0396503968d041e584bf9 /mm
parent90f1e7481eebfd47e7dbf7c8c0cbfe31e025e031 (diff)
parent3062aa50a6b2c3103470178fe7506c450d79ebe5 (diff)
Merge branch 'frv' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-2.6-frv
* 'frv' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-2.6-frv: FRV: Use generic show_interrupts() FRV: Convert genirq namespace frv: Select GENERIC_HARDIRQS_NO_DEPRECATED frv: Convert cpu irq_chip to new functions frv: Convert mb93493 irq_chip to new functions frv: Convert mb93093 irq_chip to new function frv: Convert mb93091 irq_chip to new functions frv: Fix typo from __do_IRQ overhaul frv: Remove stale irq_chip.end FRV: Do some cleanups FRV: Missing node arg in alloc_thread_info_node() macro NOMMU: implement access_remote_vm NOMMU: support SMP dynamic percpu_alloc NOMMU: percpu should use is_vmalloc_addr().
Diffstat (limited to 'mm')
-rw-r--r--mm/nommu.c52
-rw-r--r--mm/percpu.c3
2 files changed, 40 insertions, 15 deletions
diff --git a/mm/nommu.c b/mm/nommu.c
index cb86e7d5e7f5..c4c542c736a9 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -1971,21 +1971,10 @@ int filemap_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
1971} 1971}
1972EXPORT_SYMBOL(filemap_fault); 1972EXPORT_SYMBOL(filemap_fault);
1973 1973
1974/* 1974static int __access_remote_vm(struct task_struct *tsk, struct mm_struct *mm,
1975 * Access another process' address space. 1975 unsigned long addr, void *buf, int len, int write)
1976 * - source/target buffer must be kernel space
1977 */
1978int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write)
1979{ 1976{
1980 struct vm_area_struct *vma; 1977 struct vm_area_struct *vma;
1981 struct mm_struct *mm;
1982
1983 if (addr + len < addr)
1984 return 0;
1985
1986 mm = get_task_mm(tsk);
1987 if (!mm)
1988 return 0;
1989 1978
1990 down_read(&mm->mmap_sem); 1979 down_read(&mm->mmap_sem);
1991 1980
@@ -2010,6 +1999,43 @@ int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, in
2010 } 1999 }
2011 2000
2012 up_read(&mm->mmap_sem); 2001 up_read(&mm->mmap_sem);
2002
2003 return len;
2004}
2005
2006/**
2007 * @access_remote_vm - access another process' address space
2008 * @mm: the mm_struct of the target address space
2009 * @addr: start address to access
2010 * @buf: source or destination buffer
2011 * @len: number of bytes to transfer
2012 * @write: whether the access is a write
2013 *
2014 * The caller must hold a reference on @mm.
2015 */
2016int access_remote_vm(struct mm_struct *mm, unsigned long addr,
2017 void *buf, int len, int write)
2018{
2019 return __access_remote_vm(NULL, mm, addr, buf, len, write);
2020}
2021
2022/*
2023 * Access another process' address space.
2024 * - source/target buffer must be kernel space
2025 */
2026int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, int len, int write)
2027{
2028 struct mm_struct *mm;
2029
2030 if (addr + len < addr)
2031 return 0;
2032
2033 mm = get_task_mm(tsk);
2034 if (!mm)
2035 return 0;
2036
2037 len = __access_remote_vm(tsk, mm, addr, buf, len, write);
2038
2013 mmput(mm); 2039 mmput(mm);
2014 return len; 2040 return len;
2015} 2041}
diff --git a/mm/percpu.c b/mm/percpu.c
index 3f930018aa60..55d4d113fbd3 100644
--- a/mm/percpu.c
+++ b/mm/percpu.c
@@ -1008,8 +1008,7 @@ phys_addr_t per_cpu_ptr_to_phys(void *addr)
1008 } 1008 }
1009 1009
1010 if (in_first_chunk) { 1010 if (in_first_chunk) {
1011 if ((unsigned long)addr < VMALLOC_START || 1011 if (!is_vmalloc_addr(addr))
1012 (unsigned long)addr >= VMALLOC_END)
1013 return __pa(addr); 1012 return __pa(addr);
1014 else 1013 else
1015 return page_to_phys(vmalloc_to_page(addr)); 1014 return page_to_phys(vmalloc_to_page(addr));