MIPS: Add missing VZ accessor microMIPS encodings
[linux-2.6-block.git] / include / linux / compaction.h
CommitLineData
748446bb
MG
1#ifndef _LINUX_COMPACTION_H
2#define _LINUX_COMPACTION_H
3
56de7263 4/* Return values for compact_zone() and try_to_compact_pages() */
53853e2d
VB
5/* compaction didn't start as it was deferred due to past failures */
6#define COMPACT_DEFERRED 0
56de7263 7/* compaction didn't start as it was not possible or direct reclaim was more suitable */
53853e2d 8#define COMPACT_SKIPPED 1
56de7263 9/* compaction should continue to another pageblock */
53853e2d 10#define COMPACT_CONTINUE 2
56de7263 11/* direct compaction partially compacted a zone and there are suitable pages */
53853e2d 12#define COMPACT_PARTIAL 3
56de7263 13/* The full zone was compacted */
53853e2d 14#define COMPACT_COMPLETE 4
837d026d
JK
15/* For more detailed tracepoint output */
16#define COMPACT_NO_SUITABLE_PAGE 5
17#define COMPACT_NOT_SUITABLE_ZONE 6
2d1e1041 18#define COMPACT_CONTENDED 7
fa6c7b46 19/* When adding new states, please adjust include/trace/events/compaction.h */
748446bb 20
1f9efdef
VB
21/* Used to signal whether compaction detected need_sched() or lock contention */
22/* No contention detected */
23#define COMPACT_CONTENDED_NONE 0
24/* Either need_sched() was true or fatal signal pending */
25#define COMPACT_CONTENDED_SCHED 1
26/* Zone lock or lru_lock was contended in async compaction */
27#define COMPACT_CONTENDED_LOCK 2
28
1a6d53a1
VB
29struct alloc_context; /* in mm/internal.h */
30
76ab0f53
MG
31#ifdef CONFIG_COMPACTION
32extern int sysctl_compact_memory;
33extern int sysctl_compaction_handler(struct ctl_table *table, int write,
34 void __user *buffer, size_t *length, loff_t *ppos);
5e771905
MG
35extern int sysctl_extfrag_threshold;
36extern int sysctl_extfrag_handler(struct ctl_table *table, int write,
37 void __user *buffer, size_t *length, loff_t *ppos);
5bbe3547 38extern int sysctl_compact_unevictable_allowed;
56de7263
MG
39
40extern int fragmentation_index(struct zone *zone, unsigned int order);
1a6d53a1
VB
41extern unsigned long try_to_compact_pages(gfp_t gfp_mask, unsigned int order,
42 int alloc_flags, const struct alloc_context *ac,
43 enum migrate_mode mode, int *contended);
7103f16d 44extern void compact_pgdat(pg_data_t *pgdat, int order);
62997027 45extern void reset_isolation_suitable(pg_data_t *pgdat);
ebff3980
VB
46extern unsigned long compaction_suitable(struct zone *zone, int order,
47 int alloc_flags, int classzone_idx);
4f92e258 48
24e2716f
JK
49extern void defer_compaction(struct zone *zone, int order);
50extern bool compaction_deferred(struct zone *zone, int order);
51extern void compaction_defer_reset(struct zone *zone, int order,
52 bool alloc_success);
53extern bool compaction_restarting(struct zone *zone, int order);
62997027 54
698b1b30
VB
55extern int kcompactd_run(int nid);
56extern void kcompactd_stop(int nid);
57extern void wakeup_kcompactd(pg_data_t *pgdat, int order, int classzone_idx);
58
56de7263 59#else
1a6d53a1
VB
60static inline unsigned long try_to_compact_pages(gfp_t gfp_mask,
61 unsigned int order, int alloc_flags,
62 const struct alloc_context *ac,
63 enum migrate_mode mode, int *contended)
56de7263
MG
64{
65 return COMPACT_CONTINUE;
66}
67
7103f16d 68static inline void compact_pgdat(pg_data_t *pgdat, int order)
7be62de9 69{
7be62de9
RR
70}
71
62997027
MG
72static inline void reset_isolation_suitable(pg_data_t *pgdat)
73{
74}
75
ebff3980
VB
76static inline unsigned long compaction_suitable(struct zone *zone, int order,
77 int alloc_flags, int classzone_idx)
3e7d3449
MG
78{
79 return COMPACT_SKIPPED;
80}
81
aff62249 82static inline void defer_compaction(struct zone *zone, int order)
4f92e258
MG
83{
84}
85
aff62249 86static inline bool compaction_deferred(struct zone *zone, int order)
4f92e258 87{
c59e2610 88 return true;
4f92e258
MG
89}
90
698b1b30
VB
91static inline int kcompactd_run(int nid)
92{
93 return 0;
94}
95static inline void kcompactd_stop(int nid)
96{
97}
98
99static inline void wakeup_kcompactd(pg_data_t *pgdat, int order, int classzone_idx)
100{
101}
102
76ab0f53
MG
103#endif /* CONFIG_COMPACTION */
104
ed4a6d7f
MG
105#if defined(CONFIG_COMPACTION) && defined(CONFIG_SYSFS) && defined(CONFIG_NUMA)
106extern int compaction_register_node(struct node *node);
107extern void compaction_unregister_node(struct node *node);
108
109#else
110
111static inline int compaction_register_node(struct node *node)
112{
113 return 0;
114}
115
116static inline void compaction_unregister_node(struct node *node)
117{
118}
119#endif /* CONFIG_COMPACTION && CONFIG_SYSFS && CONFIG_NUMA */
120
748446bb 121#endif /* _LINUX_COMPACTION_H */