hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/mm/compaction.c
....@@ -45,6 +45,11 @@
4545 #define CREATE_TRACE_POINTS
4646 #include <trace/events/compaction.h>
4747
48
+#undef CREATE_TRACE_POINTS
49
+#ifndef __GENKSYMS__
50
+#include <trace/hooks/mm.h>
51
+#endif
52
+
4853 #define block_start_pfn(pfn, order) round_down(pfn, 1UL << (order))
4954 #define block_end_pfn(pfn, order) ALIGN((pfn) + 1, 1UL << (order))
5055 #define pageblock_start_pfn(pfn) block_start_pfn(pfn, pageblock_order)
....@@ -1270,7 +1275,7 @@
12701275 }
12711276
12721277 static void
1273
-fast_isolate_around(struct compact_control *cc, unsigned long pfn, unsigned long nr_isolated)
1278
+fast_isolate_around(struct compact_control *cc, unsigned long pfn)
12741279 {
12751280 unsigned long start_pfn, end_pfn;
12761281 struct page *page;
....@@ -1291,21 +1296,13 @@
12911296 if (!page)
12921297 return;
12931298
1294
- /* Scan before */
1295
- if (start_pfn != pfn) {
1296
- isolate_freepages_block(cc, &start_pfn, pfn, &cc->freepages, 1, false);
1297
- if (cc->nr_freepages >= cc->nr_migratepages)
1298
- return;
1299
- }
1300
-
1301
- /* Scan after */
1302
- start_pfn = pfn + nr_isolated;
1303
- if (start_pfn < end_pfn)
1304
- isolate_freepages_block(cc, &start_pfn, end_pfn, &cc->freepages, 1, false);
1299
+ isolate_freepages_block(cc, &start_pfn, end_pfn, &cc->freepages, 1, false);
13051300
13061301 /* Skip this pageblock in the future as it's full or nearly full */
13071302 if (cc->nr_freepages < cc->nr_migratepages)
13081303 set_pageblock_skip(page);
1304
+
1305
+ return;
13091306 }
13101307
13111308 /* Search orders in round-robin fashion */
....@@ -1481,7 +1478,7 @@
14811478 return cc->free_pfn;
14821479
14831480 low_pfn = page_to_pfn(page);
1484
- fast_isolate_around(cc, low_pfn, nr_isolated);
1481
+ fast_isolate_around(cc, low_pfn);
14851482 return low_pfn;
14861483 }
14871484
....@@ -1992,6 +1989,7 @@
19921989 unsigned int order;
19931990 const int migratetype = cc->migratetype;
19941991 int ret;
1992
+ bool abort_compact = false;
19951993
19961994 /* Compaction run completes if the migrate and free scanner meet */
19971995 if (compact_scanners_met(cc)) {
....@@ -2091,7 +2089,8 @@
20912089 }
20922090
20932091 out:
2094
- if (cc->contended || fatal_signal_pending(current))
2092
+ trace_android_vh_compact_finished(&abort_compact);
2093
+ if (cc->contended || fatal_signal_pending(current) || abort_compact)
20952094 ret = COMPACT_CONTENDED;
20962095
20972096 return ret;