diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-18 11:19:03 -0400 | 
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-18 11:19:03 -0400 | 
| commit | 4d7b4ac22fbec1a03206c6cde353f2fd6942f828 (patch) | |
| tree | 2d96a9e9c28cf6fa628a278decc00ad55a8b043b /mm/mlock.c | |
| parent | 3aaf51ace5975050ab43c7d4d7e439e0ae7d13d7 (diff) | |
| parent | 94f3ca95787ada3d64339a4ecb2754236ab563f6 (diff) | |
Merge branch 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (311 commits)
  perf tools: Add mode to build without newt support
  perf symbols: symbol inconsistency message should be done only at verbose=1
  perf tui: Add explicit -lslang option
  perf options: Type check all the remaining OPT_ variants
  perf options: Type check OPT_BOOLEAN and fix the offenders
  perf options: Check v type in OPT_U?INTEGER
  perf options: Introduce OPT_UINTEGER
  perf tui: Add workaround for slang < 2.1.4
  perf record: Fix bug mismatch with -c option definition
  perf options: Introduce OPT_U64
  perf tui: Add help window to show key associations
  perf tui: Make <- exit menus too
  perf newt: Add single key shortcuts for zoom into DSO and threads
  perf newt: Exit browser unconditionally when CTRL+C, q or Q is pressed
  perf newt: Fix the 'A'/'a' shortcut for annotate
  perf newt: Make <- exit the ui_browser
  x86, perf: P4 PMU - fix counters management logic
  perf newt: Make <- zoom out filters
  perf report: Report number of events, not samples
  perf hist: Clarify events_stats fields usage
  ...
Fix up trivial conflicts in kernel/fork.c and tools/perf/builtin-record.c
Diffstat (limited to 'mm/mlock.c')
| -rw-r--r-- | mm/mlock.c | 41 | 
1 files changed, 0 insertions, 41 deletions
| diff --git a/mm/mlock.c b/mm/mlock.c index 8f4e2dfceec1..3f82720e0515 100644 --- a/mm/mlock.c +++ b/mm/mlock.c | |||
| @@ -607,44 +607,3 @@ void user_shm_unlock(size_t size, struct user_struct *user) | |||
| 607 | spin_unlock(&shmlock_user_lock); | 607 | spin_unlock(&shmlock_user_lock); | 
| 608 | free_uid(user); | 608 | free_uid(user); | 
| 609 | } | 609 | } | 
| 610 | |||
| 611 | int account_locked_memory(struct mm_struct *mm, struct rlimit *rlim, | ||
| 612 | size_t size) | ||
| 613 | { | ||
| 614 | unsigned long lim, vm, pgsz; | ||
| 615 | int error = -ENOMEM; | ||
| 616 | |||
| 617 | pgsz = PAGE_ALIGN(size) >> PAGE_SHIFT; | ||
| 618 | |||
| 619 | down_write(&mm->mmap_sem); | ||
| 620 | |||
| 621 | lim = ACCESS_ONCE(rlim[RLIMIT_AS].rlim_cur) >> PAGE_SHIFT; | ||
| 622 | vm = mm->total_vm + pgsz; | ||
| 623 | if (lim < vm) | ||
| 624 | goto out; | ||
| 625 | |||
| 626 | lim = ACCESS_ONCE(rlim[RLIMIT_MEMLOCK].rlim_cur) >> PAGE_SHIFT; | ||
| 627 | vm = mm->locked_vm + pgsz; | ||
| 628 | if (lim < vm) | ||
| 629 | goto out; | ||
| 630 | |||
| 631 | mm->total_vm += pgsz; | ||
| 632 | mm->locked_vm += pgsz; | ||
| 633 | |||
| 634 | error = 0; | ||
| 635 | out: | ||
| 636 | up_write(&mm->mmap_sem); | ||
| 637 | return error; | ||
| 638 | } | ||
| 639 | |||
| 640 | void refund_locked_memory(struct mm_struct *mm, size_t size) | ||
| 641 | { | ||
| 642 | unsigned long pgsz = PAGE_ALIGN(size) >> PAGE_SHIFT; | ||
| 643 | |||
| 644 | down_write(&mm->mmap_sem); | ||
| 645 | |||
| 646 | mm->total_vm -= pgsz; | ||
| 647 | mm->locked_vm -= pgsz; | ||
| 648 | |||
| 649 | up_write(&mm->mmap_sem); | ||
| 650 | } | ||
