Skip to content

Commit 0b57d6b

Browse files
Chen-Gangtorvalds
authored andcommitted
mm/mmap.c: remove redundant local variables for may_expand_vm()
Simplify may_expand_vm(). [akpm@linux-foundation.org: further simplification, per Naoya Horiguchi] Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com> Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent ab7a5af commit 0b57d6b

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

mm/mmap.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2988,14 +2988,7 @@ struct vm_area_struct *copy_vma(struct vm_area_struct **vmap,
29882988
*/
29892989
int may_expand_vm(struct mm_struct *mm, unsigned long npages)
29902990
{
2991-
unsigned long cur = mm->total_vm; /* pages */
2992-
unsigned long lim;
2993-
2994-
lim = rlimit(RLIMIT_AS) >> PAGE_SHIFT;
2995-
2996-
if (cur + npages > lim)
2997-
return 0;
2998-
return 1;
2991+
return mm->total_vm + npages <= rlimit(RLIMIT_AS) >> PAGE_SHIFT;
29992992
}
30002993

30012994
static int special_mapping_fault(struct vm_area_struct *vma,

0 commit comments

Comments
 (0)