diff options
author | Joonsoo Kim <iamjoonsoo.kim@lge.com> | 2015-02-11 18:27:06 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-02-11 20:06:04 -0500 |
commit | 837d026d560c5ef26abeca0441713d82e4e82cad (patch) | |
tree | 074e7941df8d83fc7fdb0680883989c84c3d654c /mm | |
parent | e34d85f0e3c60f7226e5589898b7c7c5cd2a4f02 (diff) |
mm/compaction: more trace to understand when/why compaction start/finish
It is not well analyzed that when/why compaction start/finish or not.
With these new tracepoints, we can know much more about start/finish
reason of compaction. I can find following bug with these tracepoint.
http://www.spinics.net/lists/linux-mm/msg81582.html
Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Mel Gorman <mgorman@suse.de>
Cc: David Rientjes <rientjes@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/compaction.c | 38 |
1 files changed, 34 insertions, 4 deletions
diff --git a/mm/compaction.c b/mm/compaction.c index b12df9fe10b4..b6ede459c1bb 100644 --- a/mm/compaction.c +++ b/mm/compaction.c | |||
@@ -41,6 +41,8 @@ static const char *const compaction_status_string[] = { | |||
41 | "continue", | 41 | "continue", |
42 | "partial", | 42 | "partial", |
43 | "complete", | 43 | "complete", |
44 | "no_suitable_page", | ||
45 | "not_suitable_zone", | ||
44 | }; | 46 | }; |
45 | #endif | 47 | #endif |
46 | 48 | ||
@@ -1049,7 +1051,7 @@ static isolate_migrate_t isolate_migratepages(struct zone *zone, | |||
1049 | return cc->nr_migratepages ? ISOLATE_SUCCESS : ISOLATE_NONE; | 1051 | return cc->nr_migratepages ? ISOLATE_SUCCESS : ISOLATE_NONE; |
1050 | } | 1052 | } |
1051 | 1053 | ||
1052 | static int compact_finished(struct zone *zone, struct compact_control *cc, | 1054 | static int __compact_finished(struct zone *zone, struct compact_control *cc, |
1053 | const int migratetype) | 1055 | const int migratetype) |
1054 | { | 1056 | { |
1055 | unsigned int order; | 1057 | unsigned int order; |
@@ -1104,7 +1106,20 @@ static int compact_finished(struct zone *zone, struct compact_control *cc, | |||
1104 | return COMPACT_PARTIAL; | 1106 | return COMPACT_PARTIAL; |
1105 | } | 1107 | } |
1106 | 1108 | ||
1107 | return COMPACT_CONTINUE; | 1109 | return COMPACT_NO_SUITABLE_PAGE; |
1110 | } | ||
1111 | |||
1112 | static int compact_finished(struct zone *zone, struct compact_control *cc, | ||
1113 | const int migratetype) | ||
1114 | { | ||
1115 | int ret; | ||
1116 | |||
1117 | ret = __compact_finished(zone, cc, migratetype); | ||
1118 | trace_mm_compaction_finished(zone, cc->order, ret); | ||
1119 | if (ret == COMPACT_NO_SUITABLE_PAGE) | ||
1120 | ret = COMPACT_CONTINUE; | ||
1121 | |||
1122 | return ret; | ||
1108 | } | 1123 | } |
1109 | 1124 | ||
1110 | /* | 1125 | /* |
@@ -1114,7 +1129,7 @@ static int compact_finished(struct zone *zone, struct compact_control *cc, | |||
1114 | * COMPACT_PARTIAL - If the allocation would succeed without compaction | 1129 | * COMPACT_PARTIAL - If the allocation would succeed without compaction |
1115 | * COMPACT_CONTINUE - If compaction should run now | 1130 | * COMPACT_CONTINUE - If compaction should run now |
1116 | */ | 1131 | */ |
1117 | unsigned long compaction_suitable(struct zone *zone, int order, | 1132 | static unsigned long __compaction_suitable(struct zone *zone, int order, |
1118 | int alloc_flags, int classzone_idx) | 1133 | int alloc_flags, int classzone_idx) |
1119 | { | 1134 | { |
1120 | int fragindex; | 1135 | int fragindex; |
@@ -1158,11 +1173,24 @@ unsigned long compaction_suitable(struct zone *zone, int order, | |||
1158 | */ | 1173 | */ |
1159 | fragindex = fragmentation_index(zone, order); | 1174 | fragindex = fragmentation_index(zone, order); |
1160 | if (fragindex >= 0 && fragindex <= sysctl_extfrag_threshold) | 1175 | if (fragindex >= 0 && fragindex <= sysctl_extfrag_threshold) |
1161 | return COMPACT_SKIPPED; | 1176 | return COMPACT_NOT_SUITABLE_ZONE; |
1162 | 1177 | ||
1163 | return COMPACT_CONTINUE; | 1178 | return COMPACT_CONTINUE; |
1164 | } | 1179 | } |
1165 | 1180 | ||
1181 | unsigned long compaction_suitable(struct zone *zone, int order, | ||
1182 | int alloc_flags, int classzone_idx) | ||
1183 | { | ||
1184 | unsigned long ret; | ||
1185 | |||
1186 | ret = __compaction_suitable(zone, order, alloc_flags, classzone_idx); | ||
1187 | trace_mm_compaction_suitable(zone, order, ret); | ||
1188 | if (ret == COMPACT_NOT_SUITABLE_ZONE) | ||
1189 | ret = COMPACT_SKIPPED; | ||
1190 | |||
1191 | return ret; | ||
1192 | } | ||
1193 | |||
1166 | static int compact_zone(struct zone *zone, struct compact_control *cc) | 1194 | static int compact_zone(struct zone *zone, struct compact_control *cc) |
1167 | { | 1195 | { |
1168 | int ret; | 1196 | int ret; |
@@ -1376,6 +1404,8 @@ unsigned long try_to_compact_pages(gfp_t gfp_mask, unsigned int order, | |||
1376 | if (!order || !may_enter_fs || !may_perform_io) | 1404 | if (!order || !may_enter_fs || !may_perform_io) |
1377 | return COMPACT_SKIPPED; | 1405 | return COMPACT_SKIPPED; |
1378 | 1406 | ||
1407 | trace_mm_compaction_try_to_compact_pages(order, gfp_mask, mode); | ||
1408 | |||
1379 | /* Compact each zone in the list */ | 1409 | /* Compact each zone in the list */ |
1380 | for_each_zone_zonelist_nodemask(zone, z, ac->zonelist, ac->high_zoneidx, | 1410 | for_each_zone_zonelist_nodemask(zone, z, ac->zonelist, ac->high_zoneidx, |
1381 | ac->nodemask) { | 1411 | ac->nodemask) { |