123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390 |
- #undef TRACE_SYSTEM
- #define TRACE_SYSTEM vmscan
- #if !defined(_TRACE_VMSCAN_H) || defined(TRACE_HEADER_MULTI_READ)
- #define _TRACE_VMSCAN_H
- #include <linux/types.h>
- #include <linux/tracepoint.h>
- #include <linux/mm.h>
- #include <linux/memcontrol.h>
- #include <trace/events/gfpflags.h>
- #define RECLAIM_WB_ANON 0x0001u
- #define RECLAIM_WB_FILE 0x0002u
- #define RECLAIM_WB_MIXED 0x0010u
- #define RECLAIM_WB_SYNC 0x0004u /* Unused, all reclaim async */
- #define RECLAIM_WB_ASYNC 0x0008u
- #define show_reclaim_flags(flags) \
- (flags) ? __print_flags(flags, "|", \
- {RECLAIM_WB_ANON, "RECLAIM_WB_ANON"}, \
- {RECLAIM_WB_FILE, "RECLAIM_WB_FILE"}, \
- {RECLAIM_WB_MIXED, "RECLAIM_WB_MIXED"}, \
- {RECLAIM_WB_SYNC, "RECLAIM_WB_SYNC"}, \
- {RECLAIM_WB_ASYNC, "RECLAIM_WB_ASYNC"} \
- ) : "RECLAIM_WB_NONE"
- #define trace_reclaim_flags(page) ( \
- (page_is_file_cache(page) ? RECLAIM_WB_FILE : RECLAIM_WB_ANON) | \
- (RECLAIM_WB_ASYNC) \
- )
- #define trace_shrink_flags(file) \
- ( \
- (file ? RECLAIM_WB_FILE : RECLAIM_WB_ANON) | \
- (RECLAIM_WB_ASYNC) \
- )
- TRACE_EVENT(mm_vmscan_kswapd_sleep,
- TP_PROTO(int nid),
- TP_ARGS(nid),
- TP_STRUCT__entry(
- __field( int, nid )
- ),
- TP_fast_assign(
- __entry->nid = nid;
- ),
- TP_printk("nid=%d", __entry->nid)
- );
- TRACE_EVENT(mm_vmscan_kswapd_wake,
- TP_PROTO(int nid, int order),
- TP_ARGS(nid, order),
- TP_STRUCT__entry(
- __field( int, nid )
- __field( int, order )
- ),
- TP_fast_assign(
- __entry->nid = nid;
- __entry->order = order;
- ),
- TP_printk("nid=%d order=%d", __entry->nid, __entry->order)
- );
- TRACE_EVENT(mm_vmscan_wakeup_kswapd,
- TP_PROTO(int nid, int zid, int order),
- TP_ARGS(nid, zid, order),
- TP_STRUCT__entry(
- __field( int, nid )
- __field( int, zid )
- __field( int, order )
- ),
- TP_fast_assign(
- __entry->nid = nid;
- __entry->zid = zid;
- __entry->order = order;
- ),
- TP_printk("nid=%d zid=%d order=%d",
- __entry->nid,
- __entry->zid,
- __entry->order)
- );
- DECLARE_EVENT_CLASS(mm_vmscan_direct_reclaim_begin_template,
- TP_PROTO(int order, int may_writepage, gfp_t gfp_flags),
- TP_ARGS(order, may_writepage, gfp_flags),
- TP_STRUCT__entry(
- __field( int, order )
- __field( int, may_writepage )
- __field( gfp_t, gfp_flags )
- ),
- TP_fast_assign(
- __entry->order = order;
- __entry->may_writepage = may_writepage;
- __entry->gfp_flags = gfp_flags;
- ),
- TP_printk("order=%d may_writepage=%d gfp_flags=%s",
- __entry->order,
- __entry->may_writepage,
- show_gfp_flags(__entry->gfp_flags))
- );
- DEFINE_EVENT(mm_vmscan_direct_reclaim_begin_template, mm_vmscan_direct_reclaim_begin,
- TP_PROTO(int order, int may_writepage, gfp_t gfp_flags),
- TP_ARGS(order, may_writepage, gfp_flags)
- );
- DEFINE_EVENT(mm_vmscan_direct_reclaim_begin_template, mm_vmscan_memcg_reclaim_begin,
- TP_PROTO(int order, int may_writepage, gfp_t gfp_flags),
- TP_ARGS(order, may_writepage, gfp_flags)
- );
- DEFINE_EVENT(mm_vmscan_direct_reclaim_begin_template, mm_vmscan_memcg_softlimit_reclaim_begin,
- TP_PROTO(int order, int may_writepage, gfp_t gfp_flags),
- TP_ARGS(order, may_writepage, gfp_flags)
- );
- DECLARE_EVENT_CLASS(mm_vmscan_direct_reclaim_end_template,
- TP_PROTO(unsigned long nr_reclaimed),
- TP_ARGS(nr_reclaimed),
- TP_STRUCT__entry(
- __field( unsigned long, nr_reclaimed )
- ),
- TP_fast_assign(
- __entry->nr_reclaimed = nr_reclaimed;
- ),
- TP_printk("nr_reclaimed=%lu", __entry->nr_reclaimed)
- );
- DEFINE_EVENT(mm_vmscan_direct_reclaim_end_template, mm_vmscan_direct_reclaim_end,
- TP_PROTO(unsigned long nr_reclaimed),
- TP_ARGS(nr_reclaimed)
- );
- DEFINE_EVENT(mm_vmscan_direct_reclaim_end_template, mm_vmscan_memcg_reclaim_end,
- TP_PROTO(unsigned long nr_reclaimed),
- TP_ARGS(nr_reclaimed)
- );
- DEFINE_EVENT(mm_vmscan_direct_reclaim_end_template, mm_vmscan_memcg_softlimit_reclaim_end,
- TP_PROTO(unsigned long nr_reclaimed),
- TP_ARGS(nr_reclaimed)
- );
- TRACE_EVENT(mm_shrink_slab_start,
- TP_PROTO(struct shrinker *shr, struct shrink_control *sc,
- long nr_objects_to_shrink, unsigned long pgs_scanned,
- unsigned long lru_pgs, unsigned long cache_items,
- unsigned long long delta, unsigned long total_scan),
- TP_ARGS(shr, sc, nr_objects_to_shrink, pgs_scanned, lru_pgs,
- cache_items, delta, total_scan),
- TP_STRUCT__entry(
- __field(struct shrinker *, shr)
- __field(void *, shrink)
- __field(int, nid)
- __field(long, nr_objects_to_shrink)
- __field(gfp_t, gfp_flags)
- __field(unsigned long, pgs_scanned)
- __field(unsigned long, lru_pgs)
- __field(unsigned long, cache_items)
- __field(unsigned long long, delta)
- __field(unsigned long, total_scan)
- ),
- TP_fast_assign(
- __entry->shr = shr;
- __entry->shrink = shr->scan_objects;
- __entry->nid = sc->nid;
- __entry->nr_objects_to_shrink = nr_objects_to_shrink;
- __entry->gfp_flags = sc->gfp_mask;
- __entry->pgs_scanned = pgs_scanned;
- __entry->lru_pgs = lru_pgs;
- __entry->cache_items = cache_items;
- __entry->delta = delta;
- __entry->total_scan = total_scan;
- ),
- TP_printk("%pF %p: nid: %d objects to shrink %ld gfp_flags %s pgs_scanned %ld lru_pgs %ld cache items %ld delta %lld total_scan %ld",
- __entry->shrink,
- __entry->shr,
- __entry->nid,
- __entry->nr_objects_to_shrink,
- show_gfp_flags(__entry->gfp_flags),
- __entry->pgs_scanned,
- __entry->lru_pgs,
- __entry->cache_items,
- __entry->delta,
- __entry->total_scan)
- );
- TRACE_EVENT(mm_shrink_slab_end,
- TP_PROTO(struct shrinker *shr, int nid, int shrinker_retval,
- long unused_scan_cnt, long new_scan_cnt, long total_scan),
- TP_ARGS(shr, nid, shrinker_retval, unused_scan_cnt, new_scan_cnt,
- total_scan),
- TP_STRUCT__entry(
- __field(struct shrinker *, shr)
- __field(int, nid)
- __field(void *, shrink)
- __field(long, unused_scan)
- __field(long, new_scan)
- __field(int, retval)
- __field(long, total_scan)
- ),
- TP_fast_assign(
- __entry->shr = shr;
- __entry->nid = nid;
- __entry->shrink = shr->scan_objects;
- __entry->unused_scan = unused_scan_cnt;
- __entry->new_scan = new_scan_cnt;
- __entry->retval = shrinker_retval;
- __entry->total_scan = total_scan;
- ),
- TP_printk("%pF %p: nid: %d unused scan count %ld new scan count %ld total_scan %ld last shrinker return val %d",
- __entry->shrink,
- __entry->shr,
- __entry->nid,
- __entry->unused_scan,
- __entry->new_scan,
- __entry->total_scan,
- __entry->retval)
- );
- DECLARE_EVENT_CLASS(mm_vmscan_lru_isolate_template,
- TP_PROTO(int order,
- unsigned long nr_requested,
- unsigned long nr_scanned,
- unsigned long nr_taken,
- isolate_mode_t isolate_mode,
- int file),
- TP_ARGS(order, nr_requested, nr_scanned, nr_taken, isolate_mode, file),
- TP_STRUCT__entry(
- __field(int, order)
- __field(unsigned long, nr_requested)
- __field(unsigned long, nr_scanned)
- __field(unsigned long, nr_taken)
- __field(isolate_mode_t, isolate_mode)
- __field(int, file)
- ),
- TP_fast_assign(
- __entry->order = order;
- __entry->nr_requested = nr_requested;
- __entry->nr_scanned = nr_scanned;
- __entry->nr_taken = nr_taken;
- __entry->isolate_mode = isolate_mode;
- __entry->file = file;
- ),
- TP_printk("isolate_mode=%d order=%d nr_requested=%lu nr_scanned=%lu nr_taken=%lu file=%d",
- __entry->isolate_mode,
- __entry->order,
- __entry->nr_requested,
- __entry->nr_scanned,
- __entry->nr_taken,
- __entry->file)
- );
- DEFINE_EVENT(mm_vmscan_lru_isolate_template, mm_vmscan_lru_isolate,
- TP_PROTO(int order,
- unsigned long nr_requested,
- unsigned long nr_scanned,
- unsigned long nr_taken,
- isolate_mode_t isolate_mode,
- int file),
- TP_ARGS(order, nr_requested, nr_scanned, nr_taken, isolate_mode, file)
- );
- DEFINE_EVENT(mm_vmscan_lru_isolate_template, mm_vmscan_memcg_isolate,
- TP_PROTO(int order,
- unsigned long nr_requested,
- unsigned long nr_scanned,
- unsigned long nr_taken,
- isolate_mode_t isolate_mode,
- int file),
- TP_ARGS(order, nr_requested, nr_scanned, nr_taken, isolate_mode, file)
- );
- TRACE_EVENT(mm_vmscan_writepage,
- TP_PROTO(struct page *page,
- int reclaim_flags),
- TP_ARGS(page, reclaim_flags),
- TP_STRUCT__entry(
- __field(unsigned long, pfn)
- __field(int, reclaim_flags)
- ),
- TP_fast_assign(
- __entry->pfn = page_to_pfn(page);
- __entry->reclaim_flags = reclaim_flags;
- ),
- TP_printk("page=%p pfn=%lu flags=%s",
- pfn_to_page(__entry->pfn),
- __entry->pfn,
- show_reclaim_flags(__entry->reclaim_flags))
- );
- TRACE_EVENT(mm_vmscan_lru_shrink_inactive,
- TP_PROTO(int nid, int zid,
- unsigned long nr_scanned, unsigned long nr_reclaimed,
- int priority, int reclaim_flags),
- TP_ARGS(nid, zid, nr_scanned, nr_reclaimed, priority, reclaim_flags),
- TP_STRUCT__entry(
- __field(int, nid)
- __field(int, zid)
- __field(unsigned long, nr_scanned)
- __field(unsigned long, nr_reclaimed)
- __field(int, priority)
- __field(int, reclaim_flags)
- ),
- TP_fast_assign(
- __entry->nid = nid;
- __entry->zid = zid;
- __entry->nr_scanned = nr_scanned;
- __entry->nr_reclaimed = nr_reclaimed;
- __entry->priority = priority;
- __entry->reclaim_flags = reclaim_flags;
- ),
- TP_printk("nid=%d zid=%d nr_scanned=%ld nr_reclaimed=%ld priority=%d flags=%s",
- __entry->nid, __entry->zid,
- __entry->nr_scanned, __entry->nr_reclaimed,
- __entry->priority,
- show_reclaim_flags(__entry->reclaim_flags))
- );
- #endif /* _TRACE_VMSCAN_H */
- /* This part must be outside protection */
- #include <trace/define_trace.h>
|