hc
2023-12-08 01573e231f18eb2d99162747186f59511f56b64d
kernel/include/linux/compaction.h
....@@ -29,9 +29,6 @@
2929 /* compaction didn't start as it was deferred due to past failures */
3030 COMPACT_DEFERRED,
3131
32
- /* compaction not active last round */
33
- COMPACT_INACTIVE = COMPACT_DEFERRED,
34
-
3532 /* For more detailed tracepoint output - internal to compaction */
3633 COMPACT_NO_SUITABLE_PAGE,
3734 /* compaction should continue to another pageblock */
....@@ -85,20 +82,23 @@
8582
8683 #ifdef CONFIG_COMPACTION
8784 extern int sysctl_compact_memory;
85
+extern unsigned int sysctl_compaction_proactiveness;
8886 extern int sysctl_compaction_handler(struct ctl_table *table, int write,
89
- void __user *buffer, size_t *length, loff_t *ppos);
87
+ void *buffer, size_t *length, loff_t *ppos);
88
+extern int compaction_proactiveness_sysctl_handler(struct ctl_table *table,
89
+ int write, void *buffer, size_t *length, loff_t *ppos);
9090 extern int sysctl_extfrag_threshold;
91
-extern int sysctl_extfrag_handler(struct ctl_table *table, int write,
92
- void __user *buffer, size_t *length, loff_t *ppos);
9391 extern int sysctl_compact_unevictable_allowed;
9492
93
+extern unsigned int extfrag_for_order(struct zone *zone, unsigned int order);
9594 extern int fragmentation_index(struct zone *zone, unsigned int order);
9695 extern enum compact_result try_to_compact_pages(gfp_t gfp_mask,
9796 unsigned int order, unsigned int alloc_flags,
98
- const struct alloc_context *ac, enum compact_priority prio);
97
+ const struct alloc_context *ac, enum compact_priority prio,
98
+ struct page **page);
9999 extern void reset_isolation_suitable(pg_data_t *pgdat);
100100 extern enum compact_result compaction_suitable(struct zone *zone, int order,
101
- unsigned int alloc_flags, int classzone_idx);
101
+ unsigned int alloc_flags, int highest_zoneidx);
102102
103103 extern void defer_compaction(struct zone *zone, int order);
104104 extern bool compaction_deferred(struct zone *zone, int order);
....@@ -130,11 +130,8 @@
130130 return false;
131131 }
132132
133
-/*
134
- * Compaction has backed off for some reason. It might be throttling or
135
- * lock contention. Retrying is still worthwhile.
136
- */
137
-static inline bool compaction_withdrawn(enum compact_result result)
133
+/* Compaction needs reclaim to be performed first, so it can continue. */
134
+static inline bool compaction_needs_reclaim(enum compact_result result)
138135 {
139136 /*
140137 * Compaction backed off due to watermark checks for order-0
....@@ -143,6 +140,16 @@
143140 if (result == COMPACT_SKIPPED)
144141 return true;
145142
143
+ return false;
144
+}
145
+
146
+/*
147
+ * Compaction has backed off for some reason after doing some work or none
148
+ * at all. It might be throttling or lock contention. Retrying might be still
149
+ * worthwhile, but with a higher priority if allowed.
150
+ */
151
+static inline bool compaction_withdrawn(enum compact_result result)
152
+{
146153 /*
147154 * If compaction is deferred for high-order allocations, it is
148155 * because sync compaction recently failed. If this is the case
....@@ -176,7 +183,9 @@
176183
177184 extern int kcompactd_run(int nid);
178185 extern void kcompactd_stop(int nid);
179
-extern void wakeup_kcompactd(pg_data_t *pgdat, int order, int classzone_idx);
186
+extern void wakeup_kcompactd(pg_data_t *pgdat, int order, int highest_zoneidx);
187
+extern unsigned long isolate_and_split_free_page(struct page *page,
188
+ struct list_head *list);
180189
181190 #else
182191 static inline void reset_isolation_suitable(pg_data_t *pgdat)
....@@ -184,7 +193,7 @@
184193 }
185194
186195 static inline enum compact_result compaction_suitable(struct zone *zone, int order,
187
- int alloc_flags, int classzone_idx)
196
+ int alloc_flags, int highest_zoneidx)
188197 {
189198 return COMPACT_SKIPPED;
190199 }
....@@ -208,6 +217,11 @@
208217 return false;
209218 }
210219
220
+static inline bool compaction_needs_reclaim(enum compact_result result)
221
+{
222
+ return false;
223
+}
224
+
211225 static inline bool compaction_withdrawn(enum compact_result result)
212226 {
213227 return true;
....@@ -221,14 +235,21 @@
221235 {
222236 }
223237
224
-static inline void wakeup_kcompactd(pg_data_t *pgdat, int order, int classzone_idx)
238
+static inline void wakeup_kcompactd(pg_data_t *pgdat,
239
+ int order, int highest_zoneidx)
225240 {
241
+}
242
+
243
+static inline unsigned long isolate_and_split_free_page(struct page *page,
244
+ struct list_head *list)
245
+{
246
+ return 0;
226247 }
227248
228249 #endif /* CONFIG_COMPACTION */
229250
230
-#if defined(CONFIG_COMPACTION) && defined(CONFIG_SYSFS) && defined(CONFIG_NUMA)
231251 struct node;
252
+#if defined(CONFIG_COMPACTION) && defined(CONFIG_SYSFS) && defined(CONFIG_NUMA)
232253 extern int compaction_register_node(struct node *node);
233254 extern void compaction_unregister_node(struct node *node);
234255