From: Ashish Mhetre <amhetre@nvidia.com>
To: linux-mm@kvack.org, akpm@linux-foundation.org
Cc: amhetre@nvidia.com, vdumpa@nvidia.com, Snikam@nvidia.com
Subject: [PATCH] mm: Disable movable allocation for TRANSHUGE pages
Date: Tue, 25 Sep 2018 12:55:33 +0530 [thread overview]
Message-ID: <1537860333-28416-1-git-send-email-amhetre@nvidia.com> (raw)
TRANSHUGE pages have no migration support. Using CMA memory
for TRANSHUGE pages makes the memory reclaim not possible.
If TRANSHUGE pages are allocated as movable then the
allocations can come from CMA memory and make CMA reclaim fail.
To avoid this, disable movable page allocations for TRANSHUGE
pages.
Signed-off-by: Ashish Mhetre <amhetre@nvidia.com>
---
mm/huge_memory.c | 29 ++++++++++++++++++-----------
1 file changed, 18 insertions(+), 11 deletions(-)
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index 63edf18..bef509d 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -631,19 +631,26 @@ static vm_fault_t __do_huge_pmd_anonymous_page(struct vm_fault *vmf,
*/
static inline gfp_t alloc_hugepage_direct_gfpmask(struct vm_area_struct *vma)
{
+ gfp_t gfp = GFP_TRANSHUGE_LIGHT;
const bool vma_madvised = !!(vma->vm_flags & VM_HUGEPAGE);
- if (test_bit(TRANSPARENT_HUGEPAGE_DEFRAG_DIRECT_FLAG, &transparent_hugepage_flags))
- return GFP_TRANSHUGE | (vma_madvised ? 0 : __GFP_NORETRY);
- if (test_bit(TRANSPARENT_HUGEPAGE_DEFRAG_KSWAPD_FLAG, &transparent_hugepage_flags))
- return GFP_TRANSHUGE_LIGHT | __GFP_KSWAPD_RECLAIM;
- if (test_bit(TRANSPARENT_HUGEPAGE_DEFRAG_KSWAPD_OR_MADV_FLAG, &transparent_hugepage_flags))
- return GFP_TRANSHUGE_LIGHT | (vma_madvised ? __GFP_DIRECT_RECLAIM :
- __GFP_KSWAPD_RECLAIM);
- if (test_bit(TRANSPARENT_HUGEPAGE_DEFRAG_REQ_MADV_FLAG, &transparent_hugepage_flags))
- return GFP_TRANSHUGE_LIGHT | (vma_madvised ? __GFP_DIRECT_RECLAIM :
- 0);
- return GFP_TRANSHUGE_LIGHT;
+ if (test_bit(TRANSPARENT_HUGEPAGE_DEFRAG_DIRECT_FLAG,
+ &transparent_hugepage_flags))
+ gfp = GFP_TRANSHUGE | (vma_madvised ? 0 : __GFP_NORETRY);
+ if (test_bit(TRANSPARENT_HUGEPAGE_DEFRAG_KSWAPD_FLAG,
+ &transparent_hugepage_flags))
+ gfp = GFP_TRANSHUGE_LIGHT | __GFP_KSWAPD_RECLAIM;
+ if (test_bit(TRANSPARENT_HUGEPAGE_DEFRAG_KSWAPD_OR_MADV_FLAG,
+ &transparent_hugepage_flags))
+ gfp = GFP_TRANSHUGE_LIGHT | (vma_madvised ?
+ __GFP_DIRECT_RECLAIM : __GFP_KSWAPD_RECLAIM);
+ if (test_bit(TRANSPARENT_HUGEPAGE_DEFRAG_REQ_MADV_FLAG,
+ &transparent_hugepage_flags))
+ gfp = GFP_TRANSHUGE_LIGHT | (vma_madvised ?
+ __GFP_DIRECT_RECLAIM : 0);
+ gfp &= ~__GFP_MOVABLE;
+
+ return gfp;
}
/* Caller must hold page table lock. */
--
2.1.4
-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain
confidential information. Any unauthorized review, use, disclosure or distribution
is prohibited. If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------
next reply other threads:[~2018-09-25 7:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-25 7:25 Ashish Mhetre [this message]
2018-09-25 11:51 ` [PATCH] mm: Disable movable allocation for TRANSHUGE pages Kirill A. Shutemov
2018-09-25 18:30 ` Michal Hocko
2018-09-25 21:00 ` Kirill A. Shutemov
2018-09-25 21:11 ` Michal Hocko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1537860333-28416-1-git-send-email-amhetre@nvidia.com \
--to=amhetre@nvidia.com \
--cc=Snikam@nvidia.com \
--cc=akpm@linux-foundation.org \
--cc=linux-mm@kvack.org \
--cc=vdumpa@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).