From c1dced9d6dd1ecf754373b29e7c74410f6ebd01e Mon Sep 17 00:00:00 2001 From: Krishna Reddy Date: Wed, 3 Sep 2014 14:07:41 -0700 Subject: mm: avoid allocating CMA memory for stack allocation of CMA memory for user stack would cause permanent migration failures and result in CMA allocation failures. Bug 1550455 Change-Id: I75ac13416dbcf1810c89641cefdd0d56726cc36a Signed-off-by: Krishna Reddy Reviewed-on: http://git-master/r/495322 (cherry picked from commit 3c59fb443605d5975b9d8e250c4ca52ae1650fe5) Reviewed-on: http://git-master/r/592897 GVS: Gerrit_Virtual_Submit --- mm/memory.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'mm') diff --git a/mm/memory.c b/mm/memory.c index 07e1987979d9..76399cfd8927 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -3195,6 +3195,7 @@ static inline int check_stack_guard_page(struct vm_area_struct *vma, unsigned lo return 0; } +bool is_vma_temporary_stack(struct vm_area_struct *vma); /* * We enter with non-exclusive mmap_sem (to exclude vma changes, * but allow concurrent faults), and pte mapped but not yet locked. @@ -3227,7 +3228,12 @@ static int do_anonymous_page(struct mm_struct *mm, struct vm_area_struct *vma, /* Allocate our own private page. */ if (unlikely(anon_vma_prepare(vma))) goto oom; - page = alloc_zeroed_user_highpage_movable(vma, address); + if (vma->vm_flags & VM_LOCKED || flags & FAULT_FLAG_NO_CMA || + is_vma_temporary_stack(vma)) { + page = alloc_zeroed_user_highpage(GFP_HIGHUSER, vma, address); + } else { + page = alloc_zeroed_user_highpage_movable(vma, address); + } if (!page) goto oom; /* -- cgit v1.2.3