diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-04-20 20:13:58 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-04-20 20:29:13 -0400 |
commit | 6be5ceb02e98eaf6cfc4f8b12a896d04023f340d (patch) | |
tree | f34de1392300bbf63549f4eeb20f7606d6f7b1f9 /arch/tile | |
parent | a46ef99d80817a167477ed1c8b4d90ee0c2e726f (diff) |
VM: add "vm_mmap()" helper function
This continues the theme started with vm_brk() and vm_munmap():
vm_mmap() does the same thing as do_mmap(), but additionally does the
required VM locking.
This uninlines (and rewrites it to be clearer) do_mmap(), which sadly
duplicates it in mm/mmap.c and mm/nommu.c. But that way we don't have
to export our internal do_mmap_pgoff() function.
Some day we hopefully don't have to export do_mmap() either, if all
modular users can become the simpler vm_mmap() instead. We're actually
very close to that already, with the notable exception of the (broken)
use in i810, and a couple of stragglers in binfmt_elf.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/tile')
-rw-r--r-- | arch/tile/kernel/single_step.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/arch/tile/kernel/single_step.c b/arch/tile/kernel/single_step.c index 9efbc1391b3c..89529c9f0605 100644 --- a/arch/tile/kernel/single_step.c +++ b/arch/tile/kernel/single_step.c | |||
@@ -346,12 +346,10 @@ void single_step_once(struct pt_regs *regs) | |||
346 | } | 346 | } |
347 | 347 | ||
348 | /* allocate a cache line of writable, executable memory */ | 348 | /* allocate a cache line of writable, executable memory */ |
349 | down_write(¤t->mm->mmap_sem); | 349 | buffer = (void __user *) vm_mmap(NULL, 0, 64, |
350 | buffer = (void __user *) do_mmap(NULL, 0, 64, | ||
351 | PROT_EXEC | PROT_READ | PROT_WRITE, | 350 | PROT_EXEC | PROT_READ | PROT_WRITE, |
352 | MAP_PRIVATE | MAP_ANONYMOUS, | 351 | MAP_PRIVATE | MAP_ANONYMOUS, |
353 | 0); | 352 | 0); |
354 | up_write(¤t->mm->mmap_sem); | ||
355 | 353 | ||
356 | if (IS_ERR((void __force *)buffer)) { | 354 | if (IS_ERR((void __force *)buffer)) { |
357 | kfree(state); | 355 | kfree(state); |