The patch titled Subject: mm/vmscan: add tracepoints for node reclaim has been added to the -mm tree. Its filename is mm-vmscan-add-tracepoints-for-node-reclaim.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/mm-vmscan-add-tracepoints-for-node-reclaim.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/mm-vmscan-add-tracepoints-for-node-reclaim.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Yafang Shao <laoar.shao@xxxxxxxxx> Subject: mm/vmscan: add tracepoints for node reclaim The page alloc fast path it may perform node reclaim, which may cause a latency spike. We should add tracepoint for this event, and also measure the latency it causes. So bellow two tracepoints are introduced, mm_vmscan_node_reclaim_begin mm_vmscan_node_reclaim_end Link: http://lkml.kernel.org/r/1551421452-5385-1-git-send-email-laoar.shao@xxxxxxxxx Signed-off-by: Yafang Shao <laoar.shao@xxxxxxxxx> Cc: Vlastimil Babka <vbabka@xxxxxxx> Cc: Michal Hocko <mhocko@xxxxxxxx> Cc: Souptick Joarder <jrdr.linux@xxxxxxxxx> Cc: <shaoyafang@xxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- include/trace/events/vmscan.h | 32 ++++++++++++++++++++++++++++++++ mm/vmscan.c | 6 ++++++ 2 files changed, 38 insertions(+) --- a/include/trace/events/vmscan.h~mm-vmscan-add-tracepoints-for-node-reclaim +++ a/include/trace/events/vmscan.h @@ -469,6 +469,38 @@ TRACE_EVENT(mm_vmscan_inactive_list_is_l __entry->ratio, show_reclaim_flags(__entry->reclaim_flags)) ); + +TRACE_EVENT(mm_vmscan_node_reclaim_begin, + + TP_PROTO(int nid, int order, gfp_t gfp_flags), + + TP_ARGS(nid, order, gfp_flags), + + TP_STRUCT__entry( + __field(int, nid) + __field(int, order) + __field(gfp_t, gfp_flags) + ), + + TP_fast_assign( + __entry->nid = nid; + __entry->order = order; + __entry->gfp_flags = gfp_flags; + ), + + TP_printk("nid=%d order=%d gfp_flags=%s", + __entry->nid, + __entry->order, + show_gfp_flags(__entry->gfp_flags)) +); + +DEFINE_EVENT(mm_vmscan_direct_reclaim_end_template, mm_vmscan_node_reclaim_end, + + TP_PROTO(unsigned long nr_reclaimed), + + TP_ARGS(nr_reclaimed) +); + #endif /* _TRACE_VMSCAN_H */ /* This part must be outside protection */ --- a/mm/vmscan.c~mm-vmscan-add-tracepoints-for-node-reclaim +++ a/mm/vmscan.c @@ -4122,6 +4122,9 @@ static int __node_reclaim(struct pglist_ .reclaim_idx = gfp_zone(gfp_mask), }; + trace_mm_vmscan_node_reclaim_begin(pgdat->node_id, order, + sc.gfp_mask); + cond_resched(); fs_reclaim_acquire(sc.gfp_mask); /* @@ -4148,6 +4151,9 @@ static int __node_reclaim(struct pglist_ current->flags &= ~PF_SWAPWRITE; memalloc_noreclaim_restore(noreclaim_flag); fs_reclaim_release(sc.gfp_mask); + + trace_mm_vmscan_node_reclaim_end(sc.nr_reclaimed); + return sc.nr_reclaimed >= nr_pages; } _ Patches currently in -mm which might be from laoar.shao@xxxxxxxxx are mm-vmscan-drop-zone-id-from-kswapd-tracepoints.patch mm-compaction-show-gfp-flag-names-in-try_to_compact_pages-tracepoint.patch mm-compaction-some-tracepoints-should-be-defined-only-when-config_compaction-is-set.patch mm-vmscan-add-tracepoints-for-node-reclaim.patch