| .. | .. |
|---|
| 45 | 45 | #define CREATE_TRACE_POINTS |
|---|
| 46 | 46 | #include <trace/events/compaction.h> |
|---|
| 47 | 47 | |
|---|
| 48 | +#undef CREATE_TRACE_POINTS |
|---|
| 49 | +#ifndef __GENKSYMS__ |
|---|
| 50 | +#include <trace/hooks/mm.h> |
|---|
| 51 | +#endif |
|---|
| 52 | + |
|---|
| 48 | 53 | #define block_start_pfn(pfn, order) round_down(pfn, 1UL << (order)) |
|---|
| 49 | 54 | #define block_end_pfn(pfn, order) ALIGN((pfn) + 1, 1UL << (order)) |
|---|
| 50 | 55 | #define pageblock_start_pfn(pfn) block_start_pfn(pfn, pageblock_order) |
|---|
| .. | .. |
|---|
| 1270 | 1275 | } |
|---|
| 1271 | 1276 | |
|---|
| 1272 | 1277 | 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) |
|---|
| 1274 | 1279 | { |
|---|
| 1275 | 1280 | unsigned long start_pfn, end_pfn; |
|---|
| 1276 | 1281 | struct page *page; |
|---|
| .. | .. |
|---|
| 1291 | 1296 | if (!page) |
|---|
| 1292 | 1297 | return; |
|---|
| 1293 | 1298 | |
|---|
| 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); |
|---|
| 1305 | 1300 | |
|---|
| 1306 | 1301 | /* Skip this pageblock in the future as it's full or nearly full */ |
|---|
| 1307 | 1302 | if (cc->nr_freepages < cc->nr_migratepages) |
|---|
| 1308 | 1303 | set_pageblock_skip(page); |
|---|
| 1304 | + |
|---|
| 1305 | + return; |
|---|
| 1309 | 1306 | } |
|---|
| 1310 | 1307 | |
|---|
| 1311 | 1308 | /* Search orders in round-robin fashion */ |
|---|
| .. | .. |
|---|
| 1481 | 1478 | return cc->free_pfn; |
|---|
| 1482 | 1479 | |
|---|
| 1483 | 1480 | low_pfn = page_to_pfn(page); |
|---|
| 1484 | | - fast_isolate_around(cc, low_pfn, nr_isolated); |
|---|
| 1481 | + fast_isolate_around(cc, low_pfn); |
|---|
| 1485 | 1482 | return low_pfn; |
|---|
| 1486 | 1483 | } |
|---|
| 1487 | 1484 | |
|---|
| .. | .. |
|---|
| 1992 | 1989 | unsigned int order; |
|---|
| 1993 | 1990 | const int migratetype = cc->migratetype; |
|---|
| 1994 | 1991 | int ret; |
|---|
| 1992 | + bool abort_compact = false; |
|---|
| 1995 | 1993 | |
|---|
| 1996 | 1994 | /* Compaction run completes if the migrate and free scanner meet */ |
|---|
| 1997 | 1995 | if (compact_scanners_met(cc)) { |
|---|
| .. | .. |
|---|
| 2091 | 2089 | } |
|---|
| 2092 | 2090 | |
|---|
| 2093 | 2091 | 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) |
|---|
| 2095 | 2094 | ret = COMPACT_CONTENDED; |
|---|
| 2096 | 2095 | |
|---|
| 2097 | 2096 | return ret; |
|---|