Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mm/migration: add trace events for THP migrations

Patch series "mm/migration: Add trace events", v3.

This adds trace events for all migration scenarios including base page,
THP and HugeTLB.

This patch (of 3):

This adds two trace events for PMD based THP migration without split.
These events closely follow the implementation details like setting and
removing of PMD migration entries, which are essential operations for THP
migration. This moves CREATE_TRACE_POINTS into generic THP from powerpc
for these new trace events to be available on other platforms as well.

Link: https://lkml.kernel.org/r/1643368182-9588-1-git-send-email-anshuman.khandual@arm.com
Link: https://lkml.kernel.org/r/1643368182-9588-2-git-send-email-anshuman.khandual@arm.com
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Zi Yan <ziy@nvidia.com>
Cc: Naoya Horiguchi <naoya.horiguchi@nec.com>
Cc: John Hubbard <jhubbard@nvidia.com>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Paul Mackerras <paulus@samba.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Anshuman Khandual and committed by
Linus Torvalds
283fd6fe 5d543f13

+32 -1
-1
arch/powerpc/mm/book3s64/trace.c
··· 3 3 * This file is for defining trace points and trace related helpers. 4 4 */ 5 5 #ifdef CONFIG_TRANSPARENT_HUGEPAGE 6 - #define CREATE_TRACE_POINTS 7 6 #include <trace/events/thp.h> 8 7 #endif
+27
include/trace/events/thp.h
··· 48 48 TP_printk("hugepage update at addr 0x%lx and pte = 0x%lx clr = 0x%lx, set = 0x%lx", __entry->addr, __entry->pte, __entry->clr, __entry->set) 49 49 ); 50 50 51 + DECLARE_EVENT_CLASS(migration_pmd, 52 + 53 + TP_PROTO(unsigned long addr, unsigned long pmd), 54 + 55 + TP_ARGS(addr, pmd), 56 + 57 + TP_STRUCT__entry( 58 + __field(unsigned long, addr) 59 + __field(unsigned long, pmd) 60 + ), 61 + 62 + TP_fast_assign( 63 + __entry->addr = addr; 64 + __entry->pmd = pmd; 65 + ), 66 + TP_printk("addr=%lx, pmd=%lx", __entry->addr, __entry->pmd) 67 + ); 68 + 69 + DEFINE_EVENT(migration_pmd, set_migration_pmd, 70 + TP_PROTO(unsigned long addr, unsigned long pmd), 71 + TP_ARGS(addr, pmd) 72 + ); 73 + 74 + DEFINE_EVENT(migration_pmd, remove_migration_pmd, 75 + TP_PROTO(unsigned long addr, unsigned long pmd), 76 + TP_ARGS(addr, pmd) 77 + ); 51 78 #endif /* _TRACE_THP_H */ 52 79 53 80 /* This part must be outside protection */
+5
mm/huge_memory.c
··· 40 40 #include <asm/pgalloc.h> 41 41 #include "internal.h" 42 42 43 + #define CREATE_TRACE_POINTS 44 + #include <trace/events/thp.h> 45 + 43 46 /* 44 47 * By default, transparent hugepage support is disabled in order to avoid 45 48 * risking an increased memory footprint for applications that are not ··· 3134 3131 set_pmd_at(mm, address, pvmw->pmd, pmdswp); 3135 3132 page_remove_rmap(page, vma, true); 3136 3133 put_page(page); 3134 + trace_set_migration_pmd(address, pmd_val(pmdswp)); 3137 3135 } 3138 3136 3139 3137 void remove_migration_pmd(struct page_vma_mapped_walk *pvmw, struct page *new) ··· 3167 3163 3168 3164 /* No need to invalidate - it was non-present before */ 3169 3165 update_mmu_cache_pmd(vma, address, pvmw->pmd); 3166 + trace_remove_migration_pmd(address, pmd_val(pmde)); 3170 3167 } 3171 3168 #endif