Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #undef TRACE_SYSTEM
0003 #define TRACE_SYSTEM compaction
0004 
0005 #if !defined(_TRACE_COMPACTION_H) || defined(TRACE_HEADER_MULTI_READ)
0006 #define _TRACE_COMPACTION_H
0007 
0008 #include <linux/types.h>
0009 #include <linux/list.h>
0010 #include <linux/tracepoint.h>
0011 #include <trace/events/mmflags.h>
0012 
0013 
0014 DECLARE_EVENT_CLASS(mm_compaction_isolate_template,
0015 
0016     TP_PROTO(
0017         unsigned long start_pfn,
0018         unsigned long end_pfn,
0019         unsigned long nr_scanned,
0020         unsigned long nr_taken),
0021 
0022     TP_ARGS(start_pfn, end_pfn, nr_scanned, nr_taken),
0023 
0024     TP_STRUCT__entry(
0025         __field(unsigned long, start_pfn)
0026         __field(unsigned long, end_pfn)
0027         __field(unsigned long, nr_scanned)
0028         __field(unsigned long, nr_taken)
0029     ),
0030 
0031     TP_fast_assign(
0032         __entry->start_pfn = start_pfn;
0033         __entry->end_pfn = end_pfn;
0034         __entry->nr_scanned = nr_scanned;
0035         __entry->nr_taken = nr_taken;
0036     ),
0037 
0038     TP_printk("range=(0x%lx ~ 0x%lx) nr_scanned=%lu nr_taken=%lu",
0039         __entry->start_pfn,
0040         __entry->end_pfn,
0041         __entry->nr_scanned,
0042         __entry->nr_taken)
0043 );
0044 
0045 DEFINE_EVENT(mm_compaction_isolate_template, mm_compaction_isolate_migratepages,
0046 
0047     TP_PROTO(
0048         unsigned long start_pfn,
0049         unsigned long end_pfn,
0050         unsigned long nr_scanned,
0051         unsigned long nr_taken),
0052 
0053     TP_ARGS(start_pfn, end_pfn, nr_scanned, nr_taken)
0054 );
0055 
0056 DEFINE_EVENT(mm_compaction_isolate_template, mm_compaction_isolate_freepages,
0057 
0058     TP_PROTO(
0059         unsigned long start_pfn,
0060         unsigned long end_pfn,
0061         unsigned long nr_scanned,
0062         unsigned long nr_taken),
0063 
0064     TP_ARGS(start_pfn, end_pfn, nr_scanned, nr_taken)
0065 );
0066 
0067 #ifdef CONFIG_COMPACTION
0068 TRACE_EVENT(mm_compaction_migratepages,
0069 
0070     TP_PROTO(struct compact_control *cc,
0071         unsigned int nr_succeeded),
0072 
0073     TP_ARGS(cc, nr_succeeded),
0074 
0075     TP_STRUCT__entry(
0076         __field(unsigned long, nr_migrated)
0077         __field(unsigned long, nr_failed)
0078     ),
0079 
0080     TP_fast_assign(
0081         __entry->nr_migrated = nr_succeeded;
0082         __entry->nr_failed = cc->nr_migratepages - nr_succeeded;
0083     ),
0084 
0085     TP_printk("nr_migrated=%lu nr_failed=%lu",
0086         __entry->nr_migrated,
0087         __entry->nr_failed)
0088 );
0089 
0090 TRACE_EVENT(mm_compaction_begin,
0091     TP_PROTO(struct compact_control *cc, unsigned long zone_start,
0092         unsigned long zone_end, bool sync),
0093 
0094     TP_ARGS(cc, zone_start, zone_end, sync),
0095 
0096     TP_STRUCT__entry(
0097         __field(unsigned long, zone_start)
0098         __field(unsigned long, migrate_pfn)
0099         __field(unsigned long, free_pfn)
0100         __field(unsigned long, zone_end)
0101         __field(bool, sync)
0102     ),
0103 
0104     TP_fast_assign(
0105         __entry->zone_start = zone_start;
0106         __entry->migrate_pfn = cc->migrate_pfn;
0107         __entry->free_pfn = cc->free_pfn;
0108         __entry->zone_end = zone_end;
0109         __entry->sync = sync;
0110     ),
0111 
0112     TP_printk("zone_start=0x%lx migrate_pfn=0x%lx free_pfn=0x%lx zone_end=0x%lx, mode=%s",
0113         __entry->zone_start,
0114         __entry->migrate_pfn,
0115         __entry->free_pfn,
0116         __entry->zone_end,
0117         __entry->sync ? "sync" : "async")
0118 );
0119 
0120 TRACE_EVENT(mm_compaction_end,
0121     TP_PROTO(struct compact_control *cc, unsigned long zone_start,
0122         unsigned long zone_end, bool sync,
0123         int status),
0124 
0125     TP_ARGS(cc, zone_start, zone_end, sync, status),
0126 
0127     TP_STRUCT__entry(
0128         __field(unsigned long, zone_start)
0129         __field(unsigned long, migrate_pfn)
0130         __field(unsigned long, free_pfn)
0131         __field(unsigned long, zone_end)
0132         __field(bool, sync)
0133         __field(int, status)
0134     ),
0135 
0136     TP_fast_assign(
0137         __entry->zone_start = zone_start;
0138         __entry->migrate_pfn = cc->migrate_pfn;
0139         __entry->free_pfn = cc->free_pfn;
0140         __entry->zone_end = zone_end;
0141         __entry->sync = sync;
0142         __entry->status = status;
0143     ),
0144 
0145     TP_printk("zone_start=0x%lx migrate_pfn=0x%lx free_pfn=0x%lx zone_end=0x%lx, mode=%s status=%s",
0146         __entry->zone_start,
0147         __entry->migrate_pfn,
0148         __entry->free_pfn,
0149         __entry->zone_end,
0150         __entry->sync ? "sync" : "async",
0151         __print_symbolic(__entry->status, COMPACTION_STATUS))
0152 );
0153 
0154 TRACE_EVENT(mm_compaction_try_to_compact_pages,
0155 
0156     TP_PROTO(
0157         int order,
0158         gfp_t gfp_mask,
0159         int prio),
0160 
0161     TP_ARGS(order, gfp_mask, prio),
0162 
0163     TP_STRUCT__entry(
0164         __field(int, order)
0165         __field(unsigned long, gfp_mask)
0166         __field(int, prio)
0167     ),
0168 
0169     TP_fast_assign(
0170         __entry->order = order;
0171         __entry->gfp_mask = (__force unsigned long)gfp_mask;
0172         __entry->prio = prio;
0173     ),
0174 
0175     TP_printk("order=%d gfp_mask=%s priority=%d",
0176         __entry->order,
0177         show_gfp_flags(__entry->gfp_mask),
0178         __entry->prio)
0179 );
0180 
0181 DECLARE_EVENT_CLASS(mm_compaction_suitable_template,
0182 
0183     TP_PROTO(struct zone *zone,
0184         int order,
0185         int ret),
0186 
0187     TP_ARGS(zone, order, ret),
0188 
0189     TP_STRUCT__entry(
0190         __field(int, nid)
0191         __field(enum zone_type, idx)
0192         __field(int, order)
0193         __field(int, ret)
0194     ),
0195 
0196     TP_fast_assign(
0197         __entry->nid = zone_to_nid(zone);
0198         __entry->idx = zone_idx(zone);
0199         __entry->order = order;
0200         __entry->ret = ret;
0201     ),
0202 
0203     TP_printk("node=%d zone=%-8s order=%d ret=%s",
0204         __entry->nid,
0205         __print_symbolic(__entry->idx, ZONE_TYPE),
0206         __entry->order,
0207         __print_symbolic(__entry->ret, COMPACTION_STATUS))
0208 );
0209 
0210 DEFINE_EVENT(mm_compaction_suitable_template, mm_compaction_finished,
0211 
0212     TP_PROTO(struct zone *zone,
0213         int order,
0214         int ret),
0215 
0216     TP_ARGS(zone, order, ret)
0217 );
0218 
0219 DEFINE_EVENT(mm_compaction_suitable_template, mm_compaction_suitable,
0220 
0221     TP_PROTO(struct zone *zone,
0222         int order,
0223         int ret),
0224 
0225     TP_ARGS(zone, order, ret)
0226 );
0227 
0228 DECLARE_EVENT_CLASS(mm_compaction_defer_template,
0229 
0230     TP_PROTO(struct zone *zone, int order),
0231 
0232     TP_ARGS(zone, order),
0233 
0234     TP_STRUCT__entry(
0235         __field(int, nid)
0236         __field(enum zone_type, idx)
0237         __field(int, order)
0238         __field(unsigned int, considered)
0239         __field(unsigned int, defer_shift)
0240         __field(int, order_failed)
0241     ),
0242 
0243     TP_fast_assign(
0244         __entry->nid = zone_to_nid(zone);
0245         __entry->idx = zone_idx(zone);
0246         __entry->order = order;
0247         __entry->considered = zone->compact_considered;
0248         __entry->defer_shift = zone->compact_defer_shift;
0249         __entry->order_failed = zone->compact_order_failed;
0250     ),
0251 
0252     TP_printk("node=%d zone=%-8s order=%d order_failed=%d consider=%u limit=%lu",
0253         __entry->nid,
0254         __print_symbolic(__entry->idx, ZONE_TYPE),
0255         __entry->order,
0256         __entry->order_failed,
0257         __entry->considered,
0258         1UL << __entry->defer_shift)
0259 );
0260 
0261 DEFINE_EVENT(mm_compaction_defer_template, mm_compaction_deferred,
0262 
0263     TP_PROTO(struct zone *zone, int order),
0264 
0265     TP_ARGS(zone, order)
0266 );
0267 
0268 DEFINE_EVENT(mm_compaction_defer_template, mm_compaction_defer_compaction,
0269 
0270     TP_PROTO(struct zone *zone, int order),
0271 
0272     TP_ARGS(zone, order)
0273 );
0274 
0275 DEFINE_EVENT(mm_compaction_defer_template, mm_compaction_defer_reset,
0276 
0277     TP_PROTO(struct zone *zone, int order),
0278 
0279     TP_ARGS(zone, order)
0280 );
0281 
0282 TRACE_EVENT(mm_compaction_kcompactd_sleep,
0283 
0284     TP_PROTO(int nid),
0285 
0286     TP_ARGS(nid),
0287 
0288     TP_STRUCT__entry(
0289         __field(int, nid)
0290     ),
0291 
0292     TP_fast_assign(
0293         __entry->nid = nid;
0294     ),
0295 
0296     TP_printk("nid=%d", __entry->nid)
0297 );
0298 
0299 DECLARE_EVENT_CLASS(kcompactd_wake_template,
0300 
0301     TP_PROTO(int nid, int order, enum zone_type highest_zoneidx),
0302 
0303     TP_ARGS(nid, order, highest_zoneidx),
0304 
0305     TP_STRUCT__entry(
0306         __field(int, nid)
0307         __field(int, order)
0308         __field(enum zone_type, highest_zoneidx)
0309     ),
0310 
0311     TP_fast_assign(
0312         __entry->nid = nid;
0313         __entry->order = order;
0314         __entry->highest_zoneidx = highest_zoneidx;
0315     ),
0316 
0317     /*
0318      * classzone_idx is previous name of the highest_zoneidx.
0319      * Reason not to change it is the ABI requirement of the tracepoint.
0320      */
0321     TP_printk("nid=%d order=%d classzone_idx=%-8s",
0322         __entry->nid,
0323         __entry->order,
0324         __print_symbolic(__entry->highest_zoneidx, ZONE_TYPE))
0325 );
0326 
0327 DEFINE_EVENT(kcompactd_wake_template, mm_compaction_wakeup_kcompactd,
0328 
0329     TP_PROTO(int nid, int order, enum zone_type highest_zoneidx),
0330 
0331     TP_ARGS(nid, order, highest_zoneidx)
0332 );
0333 
0334 DEFINE_EVENT(kcompactd_wake_template, mm_compaction_kcompactd_wake,
0335 
0336     TP_PROTO(int nid, int order, enum zone_type highest_zoneidx),
0337 
0338     TP_ARGS(nid, order, highest_zoneidx)
0339 );
0340 #endif
0341 
0342 #endif /* _TRACE_COMPACTION_H */
0343 
0344 /* This part must be outside protection */
0345 #include <trace/define_trace.h>