diff options
| author | Ingo Molnar <mingo@elte.hu> | 2008-06-25 06:32:01 -0400 |
|---|---|---|
| committer | Ingo Molnar <mingo@elte.hu> | 2008-06-25 06:32:01 -0400 |
| commit | da7878d75b8520c9ae00d27dfbbce546a7bfdfbb (patch) | |
| tree | 547fd497a80818a60ac36831377d5df97868173c /mm/mmap.c | |
| parent | 0e50a4c6ab94ffe7e5515b86b5df9e5abc8c6b13 (diff) | |
| parent | 543cf4cb3fe6f6cae3651ba918b9c56200b257d0 (diff) | |
Merge branch 'linus' into x86/pebs
Diffstat (limited to 'mm/mmap.c')
| -rw-r--r-- | mm/mmap.c | 12 |
1 files changed, 9 insertions, 3 deletions
| @@ -80,7 +80,7 @@ EXPORT_SYMBOL(vm_get_page_prot); | |||
| 80 | int sysctl_overcommit_memory = OVERCOMMIT_GUESS; /* heuristic overcommit */ | 80 | int sysctl_overcommit_memory = OVERCOMMIT_GUESS; /* heuristic overcommit */ |
| 81 | int sysctl_overcommit_ratio = 50; /* default is 50% */ | 81 | int sysctl_overcommit_ratio = 50; /* default is 50% */ |
| 82 | int sysctl_max_map_count __read_mostly = DEFAULT_MAX_MAP_COUNT; | 82 | int sysctl_max_map_count __read_mostly = DEFAULT_MAX_MAP_COUNT; |
| 83 | atomic_t vm_committed_space = ATOMIC_INIT(0); | 83 | atomic_long_t vm_committed_space = ATOMIC_LONG_INIT(0); |
| 84 | 84 | ||
| 85 | /* | 85 | /* |
| 86 | * Check that a process has enough memory to allocate a new virtual | 86 | * Check that a process has enough memory to allocate a new virtual |
| @@ -177,7 +177,7 @@ int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin) | |||
| 177 | * cast `allowed' as a signed long because vm_committed_space | 177 | * cast `allowed' as a signed long because vm_committed_space |
| 178 | * sometimes has a negative value | 178 | * sometimes has a negative value |
| 179 | */ | 179 | */ |
| 180 | if (atomic_read(&vm_committed_space) < (long)allowed) | 180 | if (atomic_long_read(&vm_committed_space) < (long)allowed) |
| 181 | return 0; | 181 | return 0; |
| 182 | error: | 182 | error: |
| 183 | vm_unacct_memory(pages); | 183 | vm_unacct_memory(pages); |
| @@ -245,10 +245,16 @@ asmlinkage unsigned long sys_brk(unsigned long brk) | |||
| 245 | unsigned long rlim, retval; | 245 | unsigned long rlim, retval; |
| 246 | unsigned long newbrk, oldbrk; | 246 | unsigned long newbrk, oldbrk; |
| 247 | struct mm_struct *mm = current->mm; | 247 | struct mm_struct *mm = current->mm; |
| 248 | unsigned long min_brk; | ||
| 248 | 249 | ||
| 249 | down_write(&mm->mmap_sem); | 250 | down_write(&mm->mmap_sem); |
| 250 | 251 | ||
| 251 | if (brk < mm->start_brk) | 252 | #ifdef CONFIG_COMPAT_BRK |
| 253 | min_brk = mm->end_code; | ||
| 254 | #else | ||
| 255 | min_brk = mm->start_brk; | ||
| 256 | #endif | ||
| 257 | if (brk < min_brk) | ||
| 252 | goto out; | 258 | goto out; |
| 253 | 259 | ||
| 254 | /* | 260 | /* |
