Commit 132bb8cf authored by Yafang Shao's avatar Yafang Shao Committed by Linus Torvalds

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@gmail.comSigned-off-by: default avatarYafang Shao <laoar.shao@gmail.com>
Acked-by: default avatarMichal Hocko <mhocko@suse.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Souptick Joarder <jrdr.linux@gmail.com>
Cc: <shaoyafang@didiglobal.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 5e65af19
...@@ -469,6 +469,38 @@ TRACE_EVENT(mm_vmscan_inactive_list_is_low, ...@@ -469,6 +469,38 @@ TRACE_EVENT(mm_vmscan_inactive_list_is_low,
__entry->ratio, __entry->ratio,
show_reclaim_flags(__entry->reclaim_flags)) 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 */ #endif /* _TRACE_VMSCAN_H */
/* This part must be outside protection */ /* This part must be outside protection */
......
...@@ -4111,6 +4111,9 @@ static int __node_reclaim(struct pglist_data *pgdat, gfp_t gfp_mask, unsigned in ...@@ -4111,6 +4111,9 @@ static int __node_reclaim(struct pglist_data *pgdat, gfp_t gfp_mask, unsigned in
.reclaim_idx = gfp_zone(gfp_mask), .reclaim_idx = gfp_zone(gfp_mask),
}; };
trace_mm_vmscan_node_reclaim_begin(pgdat->node_id, order,
sc.gfp_mask);
cond_resched(); cond_resched();
fs_reclaim_acquire(sc.gfp_mask); fs_reclaim_acquire(sc.gfp_mask);
/* /*
...@@ -4137,6 +4140,9 @@ static int __node_reclaim(struct pglist_data *pgdat, gfp_t gfp_mask, unsigned in ...@@ -4137,6 +4140,9 @@ static int __node_reclaim(struct pglist_data *pgdat, gfp_t gfp_mask, unsigned in
current->flags &= ~PF_SWAPWRITE; current->flags &= ~PF_SWAPWRITE;
memalloc_noreclaim_restore(noreclaim_flag); memalloc_noreclaim_restore(noreclaim_flag);
fs_reclaim_release(sc.gfp_mask); fs_reclaim_release(sc.gfp_mask);
trace_mm_vmscan_node_reclaim_end(sc.nr_reclaimed);
return sc.nr_reclaimed >= nr_pages; return sc.nr_reclaimed >= nr_pages;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment