diff options
| -rw-r--r-- | mm/mmap.c | 6 | ||||
| -rw-r--r-- | mm/nommu.c | 6 |
2 files changed, 10 insertions, 2 deletions
| @@ -143,7 +143,11 @@ int __vm_enough_memory(long pages, int cap_sys_admin) | |||
| 143 | leave 3% of the size of this process for other processes */ | 143 | leave 3% of the size of this process for other processes */ |
| 144 | allowed -= current->mm->total_vm / 32; | 144 | allowed -= current->mm->total_vm / 32; |
| 145 | 145 | ||
| 146 | if (atomic_read(&vm_committed_space) < allowed) | 146 | /* |
| 147 | * cast `allowed' as a signed long because vm_committed_space | ||
| 148 | * sometimes has a negative value | ||
| 149 | */ | ||
| 150 | if (atomic_read(&vm_committed_space) < (long)allowed) | ||
| 147 | return 0; | 151 | return 0; |
| 148 | 152 | ||
| 149 | vm_unacct_memory(pages); | 153 | vm_unacct_memory(pages); |
diff --git a/mm/nommu.c b/mm/nommu.c index ce74452c02d9..fd4e8df0f02d 100644 --- a/mm/nommu.c +++ b/mm/nommu.c | |||
| @@ -1167,7 +1167,11 @@ int __vm_enough_memory(long pages, int cap_sys_admin) | |||
| 1167 | leave 3% of the size of this process for other processes */ | 1167 | leave 3% of the size of this process for other processes */ |
| 1168 | allowed -= current->mm->total_vm / 32; | 1168 | allowed -= current->mm->total_vm / 32; |
| 1169 | 1169 | ||
| 1170 | if (atomic_read(&vm_committed_space) < allowed) | 1170 | /* |
| 1171 | * cast `allowed' as a signed long because vm_committed_space | ||
| 1172 | * sometimes has a negative value | ||
| 1173 | */ | ||
| 1174 | if (atomic_read(&vm_committed_space) < (long)allowed) | ||
| 1171 | return 0; | 1175 | return 0; |
| 1172 | 1176 | ||
| 1173 | vm_unacct_memory(pages); | 1177 | vm_unacct_memory(pages); |
