mm, compaction: create compact_gap wrapper
[cascardo/linux.git] / mm / vmscan.c
index 981fc84..2a6978a 100644 (file)
@@ -2480,7 +2480,7 @@ static inline bool should_continue_reclaim(struct pglist_data *pgdat,
         * If we have not reclaimed enough pages for compaction and the
         * inactive lists are large enough, continue reclaiming
         */
-       pages_for_compaction = (2UL << sc->order);
+       pages_for_compaction = compact_gap(sc->order);
        inactive_lru_pages = node_page_state(pgdat, NR_INACTIVE_FILE);
        if (get_nr_swap_pages() > 0)
                inactive_lru_pages += node_page_state(pgdat, NR_INACTIVE_ANON);
@@ -2612,7 +2612,7 @@ static inline bool compaction_ready(struct zone *zone, struct scan_control *sc)
         * there is a buffer of free pages available to give compaction
         * a reasonable chance of completing and allocating the page
         */
-       watermark = high_wmark_pages(zone) + (2UL << sc->order);
+       watermark = high_wmark_pages(zone) + compact_gap(sc->order);
        watermark_ok = zone_watermark_ok_safe(zone, 0, watermark, sc->reclaim_idx);
 
        /*
@@ -3169,7 +3169,7 @@ static bool kswapd_shrink_node(pg_data_t *pgdat,
         * excessive reclaim. Assume that a process requested a high-order
         * can direct reclaim/compact.
         */
-       if (sc->order && sc->nr_reclaimed >= 2UL << sc->order)
+       if (sc->order && sc->nr_reclaimed >= compact_gap(sc->order))
                sc->order = 0;
 
        return sc->nr_scanned >= sc->nr_to_reclaim;