mm: rename FOLL_MLOCK to FOLL_POPULATE
[deliverable/linux.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
16c4a097 18/* When adding new state, please change compaction_status_string, too */
748446bb 19
1f9efdef
VB
20/* Used to signal whether compaction detected need_sched() or lock contention */
21/* No contention detected */
22#define COMPACT_CONTENDED_NONE 0
23/* Either need_sched() was true or fatal signal pending */
24#define COMPACT_CONTENDED_SCHED 1
25/* Zone lock or lru_lock was contended in async compaction */
26#define COMPACT_CONTENDED_LOCK 2
27
1a6d53a1
VB
28struct alloc_context; /* in mm/internal.h */
29
76ab0f53
MG
30#ifdef CONFIG_COMPACTION
31extern int sysctl_compact_memory;
32extern int sysctl_compaction_handler(struct ctl_table *table, int write,
33 void __user *buffer, size_t *length, loff_t *ppos);
5e771905
MG
34extern int sysctl_extfrag_threshold;
35extern int sysctl_extfrag_handler(struct ctl_table *table, int write,
36 void __user *buffer, size_t *length, loff_t *ppos);
56de7263
MG
37
38extern int fragmentation_index(struct zone *zone, unsigned int order);
1a6d53a1
VB
39extern unsigned long try_to_compact_pages(gfp_t gfp_mask, unsigned int order,
40 int alloc_flags, const struct alloc_context *ac,
41 enum migrate_mode mode, int *contended);
7103f16d 42extern void compact_pgdat(pg_data_t *pgdat, int order);
62997027 43extern void reset_isolation_suitable(pg_data_t *pgdat);
ebff3980
VB
44extern unsigned long compaction_suitable(struct zone *zone, int order,
45 int alloc_flags, int classzone_idx);
4f92e258 46
24e2716f
JK
47extern void defer_compaction(struct zone *zone, int order);
48extern bool compaction_deferred(struct zone *zone, int order);
49extern void compaction_defer_reset(struct zone *zone, int order,
50 bool alloc_success);
51extern bool compaction_restarting(struct zone *zone, int order);
62997027 52
56de7263 53#else
1a6d53a1
VB
54static inline unsigned long try_to_compact_pages(gfp_t gfp_mask,
55 unsigned int order, int alloc_flags,
56 const struct alloc_context *ac,
57 enum migrate_mode mode, int *contended)
56de7263
MG
58{
59 return COMPACT_CONTINUE;
60}
61
7103f16d 62static inline void compact_pgdat(pg_data_t *pgdat, int order)
7be62de9 63{
7be62de9
RR
64}
65
62997027
MG
66static inline void reset_isolation_suitable(pg_data_t *pgdat)
67{
68}
69
ebff3980
VB
70static inline unsigned long compaction_suitable(struct zone *zone, int order,
71 int alloc_flags, int classzone_idx)
3e7d3449
MG
72{
73 return COMPACT_SKIPPED;
74}
75
aff62249 76static inline void defer_compaction(struct zone *zone, int order)
4f92e258
MG
77{
78}
79
aff62249 80static inline bool compaction_deferred(struct zone *zone, int order)
4f92e258 81{
c59e2610 82 return true;
4f92e258
MG
83}
84
76ab0f53
MG
85#endif /* CONFIG_COMPACTION */
86
ed4a6d7f
MG
87#if defined(CONFIG_COMPACTION) && defined(CONFIG_SYSFS) && defined(CONFIG_NUMA)
88extern int compaction_register_node(struct node *node);
89extern void compaction_unregister_node(struct node *node);
90
91#else
92
93static inline int compaction_register_node(struct node *node)
94{
95 return 0;
96}
97
98static inline void compaction_unregister_node(struct node *node)
99{
100}
101#endif /* CONFIG_COMPACTION && CONFIG_SYSFS && CONFIG_NUMA */
102
748446bb 103#endif /* _LINUX_COMPACTION_H */
This page took 0.444827 seconds and 5 git commands to generate.