Skip to content

Commit 49cac03

Browse files
x-y-zakpm00
authored andcommitted
mm/migrate: add nr_split to trace_mm_migrate_pages stats.
Add nr_split to trace_mm_migrate_pages for large folio (including THP) split events. [akpm@linux-foundation.org: cleanup per Huang, Ying] Link: https://lkml.kernel.org/r/20231017163129.2025214-2-zi.yan@sent.com Signed-off-by: Zi Yan <ziy@nvidia.com> Reviewed-by: "Huang, Ying" <ying.huang@intel.com> Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com> Cc: David Hildenbrand <david@redhat.com> Cc: Huang Ying <ying.huang@intel.com> Cc: Matthew Wilcox <willy@infradead.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent a259945 commit 49cac03

2 files changed

Lines changed: 17 additions & 12 deletions

File tree

include/trace/events/migrate.h

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,37 +49,41 @@ TRACE_EVENT(mm_migrate_pages,
4949

5050
TP_PROTO(unsigned long succeeded, unsigned long failed,
5151
unsigned long thp_succeeded, unsigned long thp_failed,
52-
unsigned long thp_split, enum migrate_mode mode, int reason),
52+
unsigned long thp_split, unsigned long large_folio_split,
53+
enum migrate_mode mode, int reason),
5354

5455
TP_ARGS(succeeded, failed, thp_succeeded, thp_failed,
55-
thp_split, mode, reason),
56+
thp_split, large_folio_split, mode, reason),
5657

5758
TP_STRUCT__entry(
5859
__field( unsigned long, succeeded)
5960
__field( unsigned long, failed)
6061
__field( unsigned long, thp_succeeded)
6162
__field( unsigned long, thp_failed)
6263
__field( unsigned long, thp_split)
64+
__field( unsigned long, large_folio_split)
6365
__field( enum migrate_mode, mode)
6466
__field( int, reason)
6567
),
6668

6769
TP_fast_assign(
68-
__entry->succeeded = succeeded;
69-
__entry->failed = failed;
70-
__entry->thp_succeeded = thp_succeeded;
71-
__entry->thp_failed = thp_failed;
72-
__entry->thp_split = thp_split;
73-
__entry->mode = mode;
74-
__entry->reason = reason;
70+
__entry->succeeded = succeeded;
71+
__entry->failed = failed;
72+
__entry->thp_succeeded = thp_succeeded;
73+
__entry->thp_failed = thp_failed;
74+
__entry->thp_split = thp_split;
75+
__entry->large_folio_split = large_folio_split;
76+
__entry->mode = mode;
77+
__entry->reason = reason;
7578
),
7679

77-
TP_printk("nr_succeeded=%lu nr_failed=%lu nr_thp_succeeded=%lu nr_thp_failed=%lu nr_thp_split=%lu mode=%s reason=%s",
80+
TP_printk("nr_succeeded=%lu nr_failed=%lu nr_thp_succeeded=%lu nr_thp_failed=%lu nr_thp_split=%lu nr_split=%lu mode=%s reason=%s",
7881
__entry->succeeded,
7982
__entry->failed,
8083
__entry->thp_succeeded,
8184
__entry->thp_failed,
8285
__entry->thp_split,
86+
__entry->large_folio_split,
8387
__print_symbolic(__entry->mode, MIGRATE_MODE),
8488
__print_symbolic(__entry->reason, MIGRATE_REASON))
8589
);

mm/migrate.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1686,7 +1686,7 @@ static int migrate_pages_batch(struct list_head *from,
16861686

16871687
if (!ret) {
16881688
stats->nr_thp_split += is_thp;
1689-
stats->nr_split += is_large;
1689+
stats->nr_split++;
16901690
break;
16911691
} else if (reason == MR_LONGTERM_PIN &&
16921692
ret == -EAGAIN) {
@@ -1979,7 +1979,8 @@ int migrate_pages(struct list_head *from, new_folio_t get_new_folio,
19791979
count_vm_events(THP_MIGRATION_SPLIT, stats.nr_thp_split);
19801980
trace_mm_migrate_pages(stats.nr_succeeded, stats.nr_failed_pages,
19811981
stats.nr_thp_succeeded, stats.nr_thp_failed,
1982-
stats.nr_thp_split, mode, reason);
1982+
stats.nr_thp_split, stats.nr_split, mode,
1983+
reason);
19831984

19841985
if (ret_succeeded)
19851986
*ret_succeeded = stats.nr_succeeded;

0 commit comments

Comments
 (0)