1 #ifndef _LINUX_COMPACTION_H
2 #define _LINUX_COMPACTION_H
6 #define COMPACT_SKIPPED 0
8 #define COMPACT_CONTINUE 1
10 #define COMPACT_PARTIAL 2
12 #define COMPACT_COMPLETE 3
14 #ifdef CONFIG_COMPACTION
15 extern int sysctl_compact_memory;
18 extern int sysctl_extfrag_threshold;
22 extern int fragmentation_index(
struct zone *
zone,
unsigned int order);
27 extern void reset_isolation_suitable(
pg_data_t *pgdat);
28 extern unsigned long compaction_suitable(
struct zone *
zone,
int order);
31 #define COMPACT_MAX_DEFER_SHIFT 6
38 static inline void defer_compaction(
struct zone *
zone,
int order)
40 zone->compact_considered = 0;
41 zone->compact_defer_shift++;
43 if (order < zone->compact_order_failed)
44 zone->compact_order_failed =
order;
46 if (zone->compact_defer_shift > COMPACT_MAX_DEFER_SHIFT)
47 zone->compact_defer_shift = COMPACT_MAX_DEFER_SHIFT;
51 static inline bool compaction_deferred(
struct zone *zone,
int order)
53 unsigned long defer_limit = 1
UL << zone->compact_defer_shift;
55 if (order < zone->compact_order_failed)
59 if (++zone->compact_considered > defer_limit)
60 zone->compact_considered = defer_limit;
62 return zone->compact_considered < defer_limit;
66 static inline bool compaction_restarting(
struct zone *zone,
int order)
68 if (order < zone->compact_order_failed)
71 return zone->compact_defer_shift == COMPACT_MAX_DEFER_SHIFT &&
72 zone->compact_considered >= 1
UL << zone->compact_defer_shift;
83 static inline int compact_pgdat(
pg_data_t *pgdat,
int order)
88 static inline void reset_isolation_suitable(
pg_data_t *pgdat)
92 static inline unsigned long compaction_suitable(
struct zone *zone,
int order)
97 static inline void defer_compaction(
struct zone *zone,
int order)
101 static inline bool compaction_deferred(
struct zone *zone,
int order)
108 #if defined(CONFIG_COMPACTION) && defined(CONFIG_SYSFS) && defined(CONFIG_NUMA)
109 extern int compaction_register_node(
struct node *
node);
110 extern void compaction_unregister_node(
struct node *
node);
114 static inline int compaction_register_node(
struct node *
node)
119 static inline void compaction_unregister_node(
struct node *
node)