|
@@ -1812,7 +1812,8 @@ static struct page *
|
|
|
__alloc_pages_direct_compact(gfp_t gfp_mask, unsigned int order,
|
|
|
struct zonelist *zonelist, enum zone_type high_zoneidx,
|
|
|
nodemask_t *nodemask, int alloc_flags, struct zone *preferred_zone,
|
|
|
- int migratetype, unsigned long *did_some_progress)
|
|
|
+ int migratetype, unsigned long *did_some_progress,
|
|
|
+ bool sync_migration)
|
|
|
{
|
|
|
struct page *page;
|
|
|
struct task_struct *tsk = current;
|
|
@@ -1822,7 +1823,7 @@ __alloc_pages_direct_compact(gfp_t gfp_mask, unsigned int order,
|
|
|
|
|
|
tsk->flags |= PF_MEMALLOC;
|
|
|
*did_some_progress = try_to_compact_pages(zonelist, order, gfp_mask,
|
|
|
- nodemask);
|
|
|
+ nodemask, sync_migration);
|
|
|
tsk->flags &= ~PF_MEMALLOC;
|
|
|
if (*did_some_progress != COMPACT_SKIPPED) {
|
|
|
|
|
@@ -1859,7 +1860,8 @@ static inline struct page *
|
|
|
__alloc_pages_direct_compact(gfp_t gfp_mask, unsigned int order,
|
|
|
struct zonelist *zonelist, enum zone_type high_zoneidx,
|
|
|
nodemask_t *nodemask, int alloc_flags, struct zone *preferred_zone,
|
|
|
- int migratetype, unsigned long *did_some_progress)
|
|
|
+ int migratetype, unsigned long *did_some_progress,
|
|
|
+ bool sync_migration)
|
|
|
{
|
|
|
return NULL;
|
|
|
}
|
|
@@ -2001,6 +2003,7 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,
|
|
|
unsigned long pages_reclaimed = 0;
|
|
|
unsigned long did_some_progress;
|
|
|
struct task_struct *p = current;
|
|
|
+ bool sync_migration = false;
|
|
|
|
|
|
/*
|
|
|
* In the slowpath, we sanity check order to avoid ever trying to
|
|
@@ -2063,14 +2066,19 @@ rebalance:
|
|
|
if (test_thread_flag(TIF_MEMDIE) && !(gfp_mask & __GFP_NOFAIL))
|
|
|
goto nopage;
|
|
|
|
|
|
- /* Try direct compaction */
|
|
|
+ /*
|
|
|
+ * Try direct compaction. The first pass is asynchronous. Subsequent
|
|
|
+ * attempts after direct reclaim are synchronous
|
|
|
+ */
|
|
|
page = __alloc_pages_direct_compact(gfp_mask, order,
|
|
|
zonelist, high_zoneidx,
|
|
|
nodemask,
|
|
|
alloc_flags, preferred_zone,
|
|
|
- migratetype, &did_some_progress);
|
|
|
+ migratetype, &did_some_progress,
|
|
|
+ sync_migration);
|
|
|
if (page)
|
|
|
goto got_pg;
|
|
|
+ sync_migration = true;
|
|
|
|
|
|
/* Try direct reclaim and then allocating */
|
|
|
page = __alloc_pages_direct_reclaim(gfp_mask, order,
|
|
@@ -2134,7 +2142,8 @@ rebalance:
|
|
|
zonelist, high_zoneidx,
|
|
|
nodemask,
|
|
|
alloc_flags, preferred_zone,
|
|
|
- migratetype, &did_some_progress);
|
|
|
+ migratetype, &did_some_progress,
|
|
|
+ sync_migration);
|
|
|
if (page)
|
|
|
goto got_pg;
|
|
|
}
|