^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) #undef TRACE_SYSTEM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) #define TRACE_SYSTEM compaction
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) #if !defined(_TRACE_COMPACTION_H) || defined(TRACE_HEADER_MULTI_READ)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) #define _TRACE_COMPACTION_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #include <linux/list.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <linux/tracepoint.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <trace/events/mmflags.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) DECLARE_EVENT_CLASS(mm_compaction_isolate_template,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) TP_PROTO(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) unsigned long start_pfn,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) unsigned long end_pfn,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) unsigned long nr_scanned,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) unsigned long nr_taken),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) TP_ARGS(start_pfn, end_pfn, nr_scanned, nr_taken),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) TP_STRUCT__entry(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) __field(unsigned long, start_pfn)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) __field(unsigned long, end_pfn)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) __field(unsigned long, nr_scanned)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) __field(unsigned long, nr_taken)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) TP_fast_assign(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) __entry->start_pfn = start_pfn;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) __entry->end_pfn = end_pfn;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) __entry->nr_scanned = nr_scanned;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) __entry->nr_taken = nr_taken;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) TP_printk("range=(0x%lx ~ 0x%lx) nr_scanned=%lu nr_taken=%lu",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) __entry->start_pfn,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) __entry->end_pfn,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) __entry->nr_scanned,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) __entry->nr_taken)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) DEFINE_EVENT(mm_compaction_isolate_template, mm_compaction_isolate_migratepages,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) TP_PROTO(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) unsigned long start_pfn,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) unsigned long end_pfn,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) unsigned long nr_scanned,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) unsigned long nr_taken),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) TP_ARGS(start_pfn, end_pfn, nr_scanned, nr_taken)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) DEFINE_EVENT(mm_compaction_isolate_template, mm_compaction_isolate_freepages,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) TP_PROTO(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) unsigned long start_pfn,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) unsigned long end_pfn,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) unsigned long nr_scanned,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) unsigned long nr_taken),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) TP_ARGS(start_pfn, end_pfn, nr_scanned, nr_taken)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) #ifdef CONFIG_COMPACTION
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) TRACE_EVENT(mm_compaction_migratepages,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) TP_PROTO(unsigned long nr_all,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) int migrate_rc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) struct list_head *migratepages),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) TP_ARGS(nr_all, migrate_rc, migratepages),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) TP_STRUCT__entry(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) __field(unsigned long, nr_migrated)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) __field(unsigned long, nr_failed)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) TP_fast_assign(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) unsigned long nr_failed = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) struct list_head *page_lru;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) * migrate_pages() returns either a non-negative number
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) * with the number of pages that failed migration, or an
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) * error code, in which case we need to count the remaining
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) * pages manually
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) if (migrate_rc >= 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) nr_failed = migrate_rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) list_for_each(page_lru, migratepages)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) nr_failed++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) __entry->nr_migrated = nr_all - nr_failed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) __entry->nr_failed = nr_failed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) TP_printk("nr_migrated=%lu nr_failed=%lu",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) __entry->nr_migrated,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) __entry->nr_failed)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) TRACE_EVENT(mm_compaction_begin,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) TP_PROTO(unsigned long zone_start, unsigned long migrate_pfn,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) unsigned long free_pfn, unsigned long zone_end, bool sync),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) TP_ARGS(zone_start, migrate_pfn, free_pfn, zone_end, sync),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) TP_STRUCT__entry(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) __field(unsigned long, zone_start)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) __field(unsigned long, migrate_pfn)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) __field(unsigned long, free_pfn)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) __field(unsigned long, zone_end)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) __field(bool, sync)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) TP_fast_assign(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) __entry->zone_start = zone_start;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) __entry->migrate_pfn = migrate_pfn;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) __entry->free_pfn = free_pfn;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) __entry->zone_end = zone_end;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) __entry->sync = sync;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) TP_printk("zone_start=0x%lx migrate_pfn=0x%lx free_pfn=0x%lx zone_end=0x%lx, mode=%s",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) __entry->zone_start,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) __entry->migrate_pfn,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) __entry->free_pfn,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) __entry->zone_end,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) __entry->sync ? "sync" : "async")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) TRACE_EVENT(mm_compaction_end,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) TP_PROTO(unsigned long zone_start, unsigned long migrate_pfn,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) unsigned long free_pfn, unsigned long zone_end, bool sync,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) int status),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) TP_ARGS(zone_start, migrate_pfn, free_pfn, zone_end, sync, status),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) TP_STRUCT__entry(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) __field(unsigned long, zone_start)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) __field(unsigned long, migrate_pfn)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) __field(unsigned long, free_pfn)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) __field(unsigned long, zone_end)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) __field(bool, sync)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) __field(int, status)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) TP_fast_assign(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) __entry->zone_start = zone_start;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) __entry->migrate_pfn = migrate_pfn;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) __entry->free_pfn = free_pfn;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) __entry->zone_end = zone_end;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) __entry->sync = sync;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) __entry->status = status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) TP_printk("zone_start=0x%lx migrate_pfn=0x%lx free_pfn=0x%lx zone_end=0x%lx, mode=%s status=%s",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) __entry->zone_start,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) __entry->migrate_pfn,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) __entry->free_pfn,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) __entry->zone_end,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) __entry->sync ? "sync" : "async",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) __print_symbolic(__entry->status, COMPACTION_STATUS))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) TRACE_EVENT(mm_compaction_try_to_compact_pages,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) TP_PROTO(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) int order,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) gfp_t gfp_mask,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) int prio),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) TP_ARGS(order, gfp_mask, prio),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) TP_STRUCT__entry(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) __field(int, order)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) __field(gfp_t, gfp_mask)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) __field(int, prio)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) TP_fast_assign(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) __entry->order = order;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) __entry->gfp_mask = gfp_mask;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) __entry->prio = prio;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) TP_printk("order=%d gfp_mask=%s priority=%d",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) __entry->order,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) show_gfp_flags(__entry->gfp_mask),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) __entry->prio)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) DECLARE_EVENT_CLASS(mm_compaction_suitable_template,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) TP_PROTO(struct zone *zone,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) int order,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) int ret),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) TP_ARGS(zone, order, ret),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) TP_STRUCT__entry(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) __field(int, nid)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) __field(enum zone_type, idx)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) __field(int, order)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) __field(int, ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) TP_fast_assign(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) __entry->nid = zone_to_nid(zone);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) __entry->idx = zone_idx(zone);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) __entry->order = order;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) __entry->ret = ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) TP_printk("node=%d zone=%-8s order=%d ret=%s",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) __entry->nid,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) __print_symbolic(__entry->idx, ZONE_TYPE),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) __entry->order,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) __print_symbolic(__entry->ret, COMPACTION_STATUS))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) DEFINE_EVENT(mm_compaction_suitable_template, mm_compaction_finished,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) TP_PROTO(struct zone *zone,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) int order,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) int ret),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) TP_ARGS(zone, order, ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) DEFINE_EVENT(mm_compaction_suitable_template, mm_compaction_suitable,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) TP_PROTO(struct zone *zone,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) int order,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) int ret),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) TP_ARGS(zone, order, ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) DECLARE_EVENT_CLASS(mm_compaction_defer_template,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) TP_PROTO(struct zone *zone, int order),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) TP_ARGS(zone, order),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) TP_STRUCT__entry(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) __field(int, nid)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) __field(enum zone_type, idx)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) __field(int, order)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) __field(unsigned int, considered)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) __field(unsigned int, defer_shift)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) __field(int, order_failed)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) TP_fast_assign(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) __entry->nid = zone_to_nid(zone);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) __entry->idx = zone_idx(zone);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) __entry->order = order;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) __entry->considered = zone->compact_considered;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) __entry->defer_shift = zone->compact_defer_shift;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) __entry->order_failed = zone->compact_order_failed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) TP_printk("node=%d zone=%-8s order=%d order_failed=%d consider=%u limit=%lu",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) __entry->nid,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) __print_symbolic(__entry->idx, ZONE_TYPE),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) __entry->order,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) __entry->order_failed,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) __entry->considered,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) 1UL << __entry->defer_shift)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) DEFINE_EVENT(mm_compaction_defer_template, mm_compaction_deferred,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) TP_PROTO(struct zone *zone, int order),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) TP_ARGS(zone, order)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) DEFINE_EVENT(mm_compaction_defer_template, mm_compaction_defer_compaction,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) TP_PROTO(struct zone *zone, int order),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) TP_ARGS(zone, order)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) DEFINE_EVENT(mm_compaction_defer_template, mm_compaction_defer_reset,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) TP_PROTO(struct zone *zone, int order),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) TP_ARGS(zone, order)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) TRACE_EVENT(mm_compaction_kcompactd_sleep,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) TP_PROTO(int nid),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) TP_ARGS(nid),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) TP_STRUCT__entry(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) __field(int, nid)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) TP_fast_assign(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) __entry->nid = nid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) TP_printk("nid=%d", __entry->nid)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) DECLARE_EVENT_CLASS(kcompactd_wake_template,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) TP_PROTO(int nid, int order, enum zone_type highest_zoneidx),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) TP_ARGS(nid, order, highest_zoneidx),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) TP_STRUCT__entry(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) __field(int, nid)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) __field(int, order)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) __field(enum zone_type, highest_zoneidx)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) TP_fast_assign(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) __entry->nid = nid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) __entry->order = order;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) __entry->highest_zoneidx = highest_zoneidx;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) ),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) * classzone_idx is previous name of the highest_zoneidx.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) * Reason not to change it is the ABI requirement of the tracepoint.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) TP_printk("nid=%d order=%d classzone_idx=%-8s",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) __entry->nid,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) __entry->order,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) __print_symbolic(__entry->highest_zoneidx, ZONE_TYPE))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) DEFINE_EVENT(kcompactd_wake_template, mm_compaction_wakeup_kcompactd,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) TP_PROTO(int nid, int order, enum zone_type highest_zoneidx),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) TP_ARGS(nid, order, highest_zoneidx)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) DEFINE_EVENT(kcompactd_wake_template, mm_compaction_kcompactd_wake,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) TP_PROTO(int nid, int order, enum zone_type highest_zoneidx),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) TP_ARGS(nid, order, highest_zoneidx)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) );
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) #endif /* _TRACE_COMPACTION_H */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) /* This part must be outside protection */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) #include <trace/define_trace.h>