Skip to content

Commit e34d85f

Browse files
JoonsooKimtorvalds
authored andcommitted
mm/compaction: print current range where compaction work
It'd be useful to know current range where compaction work for detailed analysis. With it, we can know pageblock where we actually scan and isolate, and, how much pages we try in that pageblock and can guess why it doesn't become freepage with pageblock order roughly. Signed-off-by: Joonsoo Kim <[email protected]> Acked-by: Vlastimil Babka <[email protected]> Cc: Mel Gorman <[email protected]> Cc: David Rientjes <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 16c4a09 commit e34d85f

File tree

2 files changed

+29
-10
lines changed

2 files changed

+29
-10
lines changed

include/trace/events/compaction.h

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,39 +11,55 @@
1111

1212
DECLARE_EVENT_CLASS(mm_compaction_isolate_template,
1313

14-
TP_PROTO(unsigned long nr_scanned,
14+
TP_PROTO(
15+
unsigned long start_pfn,
16+
unsigned long end_pfn,
17+
unsigned long nr_scanned,
1518
unsigned long nr_taken),
1619

17-
TP_ARGS(nr_scanned, nr_taken),
20+
TP_ARGS(start_pfn, end_pfn, nr_scanned, nr_taken),
1821

1922
TP_STRUCT__entry(
23+
__field(unsigned long, start_pfn)
24+
__field(unsigned long, end_pfn)
2025
__field(unsigned long, nr_scanned)
2126
__field(unsigned long, nr_taken)
2227
),
2328

2429
TP_fast_assign(
30+
__entry->start_pfn = start_pfn;
31+
__entry->end_pfn = end_pfn;
2532
__entry->nr_scanned = nr_scanned;
2633
__entry->nr_taken = nr_taken;
2734
),
2835

29-
TP_printk("nr_scanned=%lu nr_taken=%lu",
36+
TP_printk("range=(0x%lx ~ 0x%lx) nr_scanned=%lu nr_taken=%lu",
37+
__entry->start_pfn,
38+
__entry->end_pfn,
3039
__entry->nr_scanned,
3140
__entry->nr_taken)
3241
);
3342

3443
DEFINE_EVENT(mm_compaction_isolate_template, mm_compaction_isolate_migratepages,
3544

36-
TP_PROTO(unsigned long nr_scanned,
45+
TP_PROTO(
46+
unsigned long start_pfn,
47+
unsigned long end_pfn,
48+
unsigned long nr_scanned,
3749
unsigned long nr_taken),
3850

39-
TP_ARGS(nr_scanned, nr_taken)
51+
TP_ARGS(start_pfn, end_pfn, nr_scanned, nr_taken)
4052
);
4153

4254
DEFINE_EVENT(mm_compaction_isolate_template, mm_compaction_isolate_freepages,
43-
TP_PROTO(unsigned long nr_scanned,
55+
56+
TP_PROTO(
57+
unsigned long start_pfn,
58+
unsigned long end_pfn,
59+
unsigned long nr_scanned,
4460
unsigned long nr_taken),
4561

46-
TP_ARGS(nr_scanned, nr_taken)
62+
TP_ARGS(start_pfn, end_pfn, nr_scanned, nr_taken)
4763
);
4864

4965
TRACE_EVENT(mm_compaction_migratepages,

mm/compaction.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -430,11 +430,12 @@ static unsigned long isolate_freepages_block(struct compact_control *cc,
430430

431431
}
432432

433+
trace_mm_compaction_isolate_freepages(*start_pfn, blockpfn,
434+
nr_scanned, total_isolated);
435+
433436
/* Record how far we have got within the block */
434437
*start_pfn = blockpfn;
435438

436-
trace_mm_compaction_isolate_freepages(nr_scanned, total_isolated);
437-
438439
/*
439440
* If strict isolation is requested by CMA then check that all the
440441
* pages requested were isolated. If there were any failures, 0 is
@@ -590,6 +591,7 @@ isolate_migratepages_block(struct compact_control *cc, unsigned long low_pfn,
590591
unsigned long flags = 0;
591592
bool locked = false;
592593
struct page *page = NULL, *valid_page = NULL;
594+
unsigned long start_pfn = low_pfn;
593595

594596
/*
595597
* Ensure that there are not too many pages isolated from the LRU
@@ -750,7 +752,8 @@ isolate_migratepages_block(struct compact_control *cc, unsigned long low_pfn,
750752
if (low_pfn == end_pfn)
751753
update_pageblock_skip(cc, valid_page, nr_isolated, true);
752754

753-
trace_mm_compaction_isolate_migratepages(nr_scanned, nr_isolated);
755+
trace_mm_compaction_isolate_migratepages(start_pfn, low_pfn,
756+
nr_scanned, nr_isolated);
754757

755758
count_compact_events(COMPACTMIGRATE_SCANNED, nr_scanned);
756759
if (nr_isolated)

0 commit comments

Comments
 (0)