The compaction capturing code assumes the allocation request order and compaction target order are the same. That won't be true once defrag_mode promotes sub-block allocations to pageblock-order compaction: compaction targets the larger order, while capture should remain at the original allocation order. Move the capture_control to the page allocator and give it its own copies of what the page freeing path matches against - zone, migratetype and the allocation order - rather than reaching into compaction's live compact_control. __alloc_pages_direct_compact() fills in migratetype and order, and installs and hides current->capture_control around the whole compaction call; try_to_compact_pages() aims capc->zone at each zone while it is being compacted. compact_zone_order() no longer deals with capture at all. Pass the capture_control through try_to_compact_pages() / compact_zone_order() in place of the bare struct page **. No functional change.
Showing the changes to include (1 of 4 files). Show all
Unified · Split
| @@ -58,6 +58,7 @@ enum compact_result { · 57 unmodified lines | |||
| 58 | }; | 58 | }; |
| 59 | 59 | ||
| 60 | struct alloc_context; /* in mm/internal.h */ | 60 | struct alloc_context; /* in mm/internal.h */ |
| 61 | struct capture_control; /* in mm/internal.h */ | ||
| 61 | 62 | ||
| 62 | /* | 63 | /* |
| 63 | * Number of free order-0 pages that should be available above given watermark | 64 | * Number of free order-0 pages that should be available above given watermark |
| @@ -92,7 +93,7 @@ extern int fragmentation_index(struct zone *zone, unsigned int order); · 28 unmodified lines | |||
| 92 | extern enum compact_result try_to_compact_pages(gfp_t gfp_mask, | 93 | extern enum compact_result try_to_compact_pages(gfp_t gfp_mask, |
| 93 | unsigned int order, unsigned int alloc_flags, | 94 | unsigned int order, unsigned int alloc_flags, |
| 94 | const struct alloc_context *ac, enum compact_priority prio, | 95 | const struct alloc_context *ac, enum compact_priority prio, |
| 95 | struct page **page); | 96 | struct capture_control *capc); |
| 96 | extern void reset_isolation_suitable(pg_data_t *pgdat); | 97 | extern void reset_isolation_suitable(pg_data_t *pgdat); |
| 97 | extern bool compaction_suitable(struct zone *zone, int order, | 98 | extern bool compaction_suitable(struct zone *zone, int order, |
| 98 | unsigned long watermark, int highest_zoneidx); | 99 | unsigned long watermark, int highest_zoneidx); |