diff options
Diffstat (limited to 'include/linux/compaction.h')
| -rw-r--r-- | include/linux/compaction.h | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/include/linux/compaction.h b/include/linux/compaction.h index bb2bbdbe5464..51a90b7f2d60 100644 --- a/include/linux/compaction.h +++ b/include/linux/compaction.h | |||
| @@ -23,6 +23,7 @@ extern int fragmentation_index(struct zone *zone, unsigned int order); | |||
| 23 | extern unsigned long try_to_compact_pages(struct zonelist *zonelist, | 23 | extern unsigned long try_to_compact_pages(struct zonelist *zonelist, |
| 24 | int order, gfp_t gfp_mask, nodemask_t *mask, | 24 | int order, gfp_t gfp_mask, nodemask_t *mask, |
| 25 | bool sync); | 25 | bool sync); |
| 26 | extern int compact_pgdat(pg_data_t *pgdat, int order); | ||
| 26 | extern unsigned long compaction_suitable(struct zone *zone, int order); | 27 | extern unsigned long compaction_suitable(struct zone *zone, int order); |
| 27 | 28 | ||
| 28 | /* Do not skip compaction more than 64 times */ | 29 | /* Do not skip compaction more than 64 times */ |
| @@ -33,20 +34,26 @@ extern unsigned long compaction_suitable(struct zone *zone, int order); | |||
| 33 | * allocation success. 1 << compact_defer_limit compactions are skipped up | 34 | * allocation success. 1 << compact_defer_limit compactions are skipped up |
| 34 | * to a limit of 1 << COMPACT_MAX_DEFER_SHIFT | 35 | * to a limit of 1 << COMPACT_MAX_DEFER_SHIFT |
| 35 | */ | 36 | */ |
| 36 | static inline void defer_compaction(struct zone *zone) | 37 | static inline void defer_compaction(struct zone *zone, int order) |
| 37 | { | 38 | { |
| 38 | zone->compact_considered = 0; | 39 | zone->compact_considered = 0; |
| 39 | zone->compact_defer_shift++; | 40 | zone->compact_defer_shift++; |
| 40 | 41 | ||
| 42 | if (order < zone->compact_order_failed) | ||
| 43 | zone->compact_order_failed = order; | ||
| 44 | |||
| 41 | if (zone->compact_defer_shift > COMPACT_MAX_DEFER_SHIFT) | 45 | if (zone->compact_defer_shift > COMPACT_MAX_DEFER_SHIFT) |
| 42 | zone->compact_defer_shift = COMPACT_MAX_DEFER_SHIFT; | 46 | zone->compact_defer_shift = COMPACT_MAX_DEFER_SHIFT; |
| 43 | } | 47 | } |
| 44 | 48 | ||
| 45 | /* Returns true if compaction should be skipped this time */ | 49 | /* Returns true if compaction should be skipped this time */ |
| 46 | static inline bool compaction_deferred(struct zone *zone) | 50 | static inline bool compaction_deferred(struct zone *zone, int order) |
| 47 | { | 51 | { |
| 48 | unsigned long defer_limit = 1UL << zone->compact_defer_shift; | 52 | unsigned long defer_limit = 1UL << zone->compact_defer_shift; |
| 49 | 53 | ||
| 54 | if (order < zone->compact_order_failed) | ||
| 55 | return false; | ||
| 56 | |||
| 50 | /* Avoid possible overflow */ | 57 | /* Avoid possible overflow */ |
| 51 | if (++zone->compact_considered > defer_limit) | 58 | if (++zone->compact_considered > defer_limit) |
| 52 | zone->compact_considered = defer_limit; | 59 | zone->compact_considered = defer_limit; |
| @@ -62,16 +69,21 @@ static inline unsigned long try_to_compact_pages(struct zonelist *zonelist, | |||
| 62 | return COMPACT_CONTINUE; | 69 | return COMPACT_CONTINUE; |
| 63 | } | 70 | } |
| 64 | 71 | ||
| 72 | static inline int compact_pgdat(pg_data_t *pgdat, int order) | ||
| 73 | { | ||
| 74 | return COMPACT_CONTINUE; | ||
| 75 | } | ||
| 76 | |||
| 65 | static inline unsigned long compaction_suitable(struct zone *zone, int order) | 77 | static inline unsigned long compaction_suitable(struct zone *zone, int order) |
| 66 | { | 78 | { |
| 67 | return COMPACT_SKIPPED; | 79 | return COMPACT_SKIPPED; |
| 68 | } | 80 | } |
| 69 | 81 | ||
| 70 | static inline void defer_compaction(struct zone *zone) | 82 | static inline void defer_compaction(struct zone *zone, int order) |
| 71 | { | 83 | { |
| 72 | } | 84 | } |
| 73 | 85 | ||
| 74 | static inline bool compaction_deferred(struct zone *zone) | 86 | static inline bool compaction_deferred(struct zone *zone, int order) |
| 75 | { | 87 | { |
| 76 | return 1; | 88 | return 1; |
| 77 | } | 89 | } |
