|
@@ -44,66 +44,11 @@ extern void reset_isolation_suitable(pg_data_t *pgdat);
|
|
|
extern unsigned long compaction_suitable(struct zone *zone, int order,
|
|
|
int alloc_flags, int classzone_idx);
|
|
|
|
|
|
-/* Do not skip compaction more than 64 times */
|
|
|
-#define COMPACT_MAX_DEFER_SHIFT 6
|
|
|
-
|
|
|
-/*
|
|
|
- * Compaction is deferred when compaction fails to result in a page
|
|
|
- * allocation success. 1 << compact_defer_limit compactions are skipped up
|
|
|
- * to a limit of 1 << COMPACT_MAX_DEFER_SHIFT
|
|
|
- */
|
|
|
-static inline void defer_compaction(struct zone *zone, int order)
|
|
|
-{
|
|
|
- zone->compact_considered = 0;
|
|
|
- zone->compact_defer_shift++;
|
|
|
-
|
|
|
- if (order < zone->compact_order_failed)
|
|
|
- zone->compact_order_failed = order;
|
|
|
-
|
|
|
- if (zone->compact_defer_shift > COMPACT_MAX_DEFER_SHIFT)
|
|
|
- zone->compact_defer_shift = COMPACT_MAX_DEFER_SHIFT;
|
|
|
-}
|
|
|
-
|
|
|
-/* Returns true if compaction should be skipped this time */
|
|
|
-static inline bool compaction_deferred(struct zone *zone, int order)
|
|
|
-{
|
|
|
- unsigned long defer_limit = 1UL << zone->compact_defer_shift;
|
|
|
-
|
|
|
- if (order < zone->compact_order_failed)
|
|
|
- return false;
|
|
|
-
|
|
|
- /* Avoid possible overflow */
|
|
|
- if (++zone->compact_considered > defer_limit)
|
|
|
- zone->compact_considered = defer_limit;
|
|
|
-
|
|
|
- return zone->compact_considered < defer_limit;
|
|
|
-}
|
|
|
-
|
|
|
-/*
|
|
|
- * Update defer tracking counters after successful compaction of given order,
|
|
|
- * which means an allocation either succeeded (alloc_success == true) or is
|
|
|
- * expected to succeed.
|
|
|
- */
|
|
|
-static inline void compaction_defer_reset(struct zone *zone, int order,
|
|
|
- bool alloc_success)
|
|
|
-{
|
|
|
- if (alloc_success) {
|
|
|
- zone->compact_considered = 0;
|
|
|
- zone->compact_defer_shift = 0;
|
|
|
- }
|
|
|
- if (order >= zone->compact_order_failed)
|
|
|
- zone->compact_order_failed = order + 1;
|
|
|
-}
|
|
|
-
|
|
|
-/* Returns true if restarting compaction after many failures */
|
|
|
-static inline bool compaction_restarting(struct zone *zone, int order)
|
|
|
-{
|
|
|
- if (order < zone->compact_order_failed)
|
|
|
- return false;
|
|
|
-
|
|
|
- return zone->compact_defer_shift == COMPACT_MAX_DEFER_SHIFT &&
|
|
|
- zone->compact_considered >= 1UL << zone->compact_defer_shift;
|
|
|
-}
|
|
|
+extern void defer_compaction(struct zone *zone, int order);
|
|
|
+extern bool compaction_deferred(struct zone *zone, int order);
|
|
|
+extern void compaction_defer_reset(struct zone *zone, int order,
|
|
|
+ bool alloc_success);
|
|
|
+extern bool compaction_restarting(struct zone *zone, int order);
|
|
|
|
|
|
#else
|
|
|
static inline unsigned long try_to_compact_pages(gfp_t gfp_mask,
|