Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1739730

[RFC 1/2] Try to use HighAtomic if try to alloc umovable page that order is not 0

From Hui Zhu <zhuhui@xiaomi.com>
Newsgroups linux.kernel
Subject [RFC 1/2] Try to use HighAtomic if try to alloc umovable page that order is not 0
Date 2017-09-26 11:10 +0200
Message-ID <utU2n-2KN-43@gated-at.bofh.it> (permalink)
References <utU2m-2KN-23@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


The page add a new condition to let gfp_to_alloc_flags return
alloc_flags with ALLOC_HARDER if the order is not 0 and migratetype is
MIGRATE_UNMOVABLE.

Then alloc umovable page that order is not 0 will try to use HighAtomic.

Signed-off-by: Hui Zhu <zhuhui@xiaomi.com>
---
 mm/page_alloc.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index c841af8..b54e94a 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -3642,7 +3642,7 @@ static void wake_all_kswapds(unsigned int order, const struct alloc_context *ac)
 }
 
 static inline unsigned int
-gfp_to_alloc_flags(gfp_t gfp_mask)
+gfp_to_alloc_flags(gfp_t gfp_mask, int order, int migratetype)
 {
 	unsigned int alloc_flags = ALLOC_WMARK_MIN | ALLOC_CPUSET;
 
@@ -3671,6 +3671,8 @@ static void wake_all_kswapds(unsigned int order, const struct alloc_context *ac)
 		alloc_flags &= ~ALLOC_CPUSET;
 	} else if (unlikely(rt_task(current)) && !in_interrupt())
 		alloc_flags |= ALLOC_HARDER;
+	else if (order > 0 && migratetype == MIGRATE_UNMOVABLE)
+		alloc_flags |= ALLOC_HARDER;
 
 #ifdef CONFIG_CMA
 	if (gfpflags_to_migratetype(gfp_mask) == MIGRATE_MOVABLE)
@@ -3903,7 +3905,7 @@ bool gfp_pfmemalloc_allowed(gfp_t gfp_mask)
 	 * kswapd needs to be woken up, and to avoid the cost of setting up
 	 * alloc_flags precisely. So we do that now.
 	 */
-	alloc_flags = gfp_to_alloc_flags(gfp_mask);
+	alloc_flags = gfp_to_alloc_flags(gfp_mask, order, ac->migratetype);
 
 	/*
 	 * We need to recalculate the starting point for the zonelist iterator
-- 
1.9.1

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC 0/2] Use HighAtomic against long-term fragmentation Hui Zhu <zhuhui@xiaomi.com> - 2017-09-26 11:10 +0200
  [RFC 1/2] Try to use HighAtomic if try to alloc umovable page that order is not 0 Hui Zhu <zhuhui@xiaomi.com> - 2017-09-26 11:10 +0200
    Re: [RFC 1/2] Try to use HighAtomic if try to alloc umovable page  that order is not 0 Michal Hocko <mhocko@kernel.org> - 2017-09-26 12:50 +0200
  Re: [RFC 0/2] Use HighAtomic against long-term fragmentation Mel Gorman <mgorman@techsingularity.net> - 2017-09-26 12:00 +0200
    Re: [RFC 0/2] Use HighAtomic against long-term fragmentation Hui Zhu <teawater@gmail.com> - 2017-09-26 12:10 +0200
      Re: [RFC 0/2] Use HighAtomic against long-term fragmentation Mel Gorman <mgorman@techsingularity.net> - 2017-09-26 12:50 +0200

csiph-web