The patch titled Subject: vmscan: limit direct reclaim for higher order allocations has been added to the -mm tree. Its filename is vmscan-limit-direct-reclaim-for-higher-order-allocations.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** See http://userweb.kernel.org/~akpm/stuff/added-to-mm.txt to find out what to do about this The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/ ------------------------------------------------------ From: Rik van Riel <riel@xxxxxxxxxx> Subject: vmscan: limit direct reclaim for higher order allocations When suffering from memory fragmentation due to unfreeable pages, THP page faults will repeatedly try to compact memory. Due to the unfreeable pages, compaction fails. Needless to say, at that point page reclaim also fails to create free contiguous 2MB areas. However, that doesn't stop the current code from trying, over and over again, and freeing a minimum of 4MB (2UL << sc->order pages) at every single invocation. This resulted in my 12GB system having 2-3GB free memory, a corresponding amount of used swap and very sluggish response times. This can be avoided by having the direct reclaim code not reclaim from zones that already have plenty of free memory available for compaction. If compaction still fails due to unmovable memory, doing additional reclaim will only hurt the system, not help. Signed-off-by: Rik van Riel <riel@xxxxxxxxxx> Acked-by: Johannes Weiner <jweiner@xxxxxxxxxx> Acked-by: Mel Gorman <mgorman@xxxxxxx> Cc: Andrea Arcangeli <aarcange@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxx> --- mm/vmscan.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff -puN mm/vmscan.c~vmscan-limit-direct-reclaim-for-higher-order-allocations mm/vmscan.c --- a/mm/vmscan.c~vmscan-limit-direct-reclaim-for-higher-order-allocations +++ a/mm/vmscan.c @@ -2108,6 +2108,16 @@ static void shrink_zones(int priority, s continue; if (zone->all_unreclaimable && priority != DEF_PRIORITY) continue; /* Let kswapd poll it */ + if (COMPACTION_BUILD) { + /* + * If we already have plenty of memory free + * for compaction, don't free any more. + */ + if (sc->order > PAGE_ALLOC_COSTLY_ORDER && + (compaction_suitable(zone, sc->order) || + compaction_deferred(zone))) + continue; + } /* * This steals pages from memory cgroups over softlimit * and returns the number of reclaimed pages and _ Subject: Subject: vmscan: limit direct reclaim for higher order allocations Patches currently in -mm which might be from riel@xxxxxxxxxx are linux-next.patch mm-compaction-trivial-clean-up-in-acct_isolated.patch mm-change-isolate-mode-from-define-to-bitwise-type.patch mm-change-isolate-mode-from-define-to-bitwise-type-fix.patch mm-compaction-make-isolate_lru_page-filter-aware.patch mm-compaction-make-isolate_lru_page-filter-aware-fix.patch mm-zone_reclaim-make-isolate_lru_page-filter-aware.patch mm-zone_reclaim-make-isolate_lru_page-filter-aware-fix.patch mm-migration-clean-up-unmap_and_move.patch mm-vmscan-do-not-writeback-filesystem-pages-in-direct-reclaim.patch mm-vmscan-remove-dead-code-related-to-lumpy-reclaim-waiting-on-pages-under-writeback.patch xfs-warn-if-direct-reclaim-tries-to-writeback-pages.patch ext4-warn-if-direct-reclaim-tries-to-writeback-pages.patch mm-vmscan-do-not-writeback-filesystem-pages-in-kswapd-except-in-high-priority.patch mm-vmscan-throttle-reclaim-if-encountering-too-many-dirty-pages-under-writeback.patch mm-vmscan-immediately-reclaim-end-of-lru-dirty-pages-when-writeback-completes.patch vmscan-promote-shared-file-mapped-pages.patch vmscan-activate-executable-pages-after-first-usage.patch mremap-check-for-overflow-using-deltas.patch mremap-avoid-sending-one-ipi-per-page.patch thp-mremap-support-and-tlb-optimization.patch thp-mremap-support-and-tlb-optimization-fix.patch thp-mremap-support-and-tlb-optimization-fix-fix.patch kswapd-avoid-unnecessary-rebalance-after-an-unsuccessful-balancing.patch mm-compaction-compact-unevictable-pages.patch mm-compaction-accounting-fix.patch mm-fix-page-faults-detection-in-swap-token-logic.patch mm-add-extra-free-kbytes-tunable.patch mm-add-extra-free-kbytes-tunable-update.patch mm-add-extra-free-kbytes-tunable-update-checkpatch-fixes.patch mm-thrashc-quiet-sparse-noise.patch mm-huge_memoryc-quiet-sparse-noise.patch vmscan-add-barrier-to-prevent-evictable-page-in-unevictable-list.patch vmscan-limit-direct-reclaim-for-higher-order-allocations.patch memcg-skip-scanning-active-lists-based-on-individual-size.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html