diff options
Diffstat (limited to 'mm/nommu.c')
-rw-r--r-- | mm/nommu.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -937,7 +937,7 @@ static int validate_mmap_request(struct file *file, struct address_space *mapping; /* files must support mmap */ - if (!file->f_op->mmap) + if (!file->f_op || !file->f_op->mmap) return -ENODEV; /* work out if what we've got could possibly be shared @@ -1948,12 +1948,13 @@ int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin) goto error; } - allowed = vm_commit_limit(); + allowed = totalram_pages * sysctl_overcommit_ratio / 100; /* * Reserve some 3% for root */ if (!cap_sys_admin) allowed -= sysctl_admin_reserve_kbytes >> (PAGE_SHIFT - 10); + allowed += total_swap_pages; /* * Don't let a single process grow so big a user can't recover |