This patch deals with a corner case found when testing kcompactd with a very simple testcase that first fragments memory (by creating a large shmem file and then punching hole in every even page) and then uses artificial order-9 GFP_NOWAIT allocations in a loop. This is freshly after virtme-run boot in KVM and no other activity. What happens is that after few kswapd runs, there are no more reclaimable pages, and high-order pages can only be created by compaction. Because kswapd can't reclaim anything, pgdat->kswapd_failures increases up to MAX_RECLAIM_RETRIES and kswapd is no longer woken up. Thus kcompactd is also not woken up. After this patch, we will try to wake up kcompactd immediately instead of kswapd. Signed-off-by: Vlastimil Babka <vbabka@xxxxxxx> --- mm/vmscan.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index a3f914c88dea..18ad0cd0c0f5 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -3578,9 +3578,15 @@ void wakeup_kswapd(struct zone *zone, int order, enum zone_type classzone_idx) if (!waitqueue_active(&pgdat->kswapd_wait)) return; - /* Hopeless node, leave it to direct reclaim */ - if (pgdat->kswapd_failures >= MAX_RECLAIM_RETRIES) + /* + * Hopeless node, leave it to direct reclaim. For high-order + * allocations, try to wake up kcompactd instead. + */ + if (pgdat->kswapd_failures >= MAX_RECLAIM_RETRIES) { + if (order) + wakeup_kcompactd(pgdat, order, classzone_idx); return; + } if (pgdat_balanced(pgdat, order, classzone_idx)) return; -- 2.13.3 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>