On Thu, 4 Jan 2024 02:01:45 -0800 Bixuan Cui <cuibixuan@xxxxxxxx> wrote: > From: cuibixuan <cuibixuan@xxxxxxxx> > > Page reclaim is an important part of memory reclaim, including: > * shrink_active_list(), moves folios from the active LRU to the inactive LRU > * shrink_inactive_list(), shrink lru from inactive LRU list > > Add the new events to calculate the execution time to better evaluate > the entire memory recycling ratio. > > Example of output: > kswapd0-103 [007] ..... 1098.353020: mm_vmscan_lru_shrink_active_start: nid=0 > kswapd0-103 [007] ..... 1098.353040: mm_vmscan_lru_shrink_active_end: nid=0 nr_taken=32 nr_active=0 nr_deactivated=32 nr_referenced=0 priority=6 flags=RECLAIM_WB_FILE|RECLAIM_WB_ASYNC > kswapd0-103 [007] ..... 1098.353040: mm_vmscan_lru_shrink_inactive_start: nid=0 > kswapd0-103 [007] ..... 1098.353094: mm_vmscan_lru_shrink_inactive_end: nid=0 nr_scanned=32 nr_reclaimed=0 nr_dirty=0 nr_writeback=0 nr_congested=0 nr_immediate=0 nr_activate_anon=0 nr_activate_file=0 nr_ref_keep=32 nr_unmap_fail=0 priority=6 flags=RECLAIM_WB_ANON|RECLAIM_WB_ASYNC > kswapd0-103 [007] ..... 1098.353094: mm_vmscan_lru_shrink_inactive_start: nid=0 > kswapd0-103 [007] ..... 1098.353162: mm_vmscan_lru_shrink_inactive_end: nid=0 nr_scanned=32 nr_reclaimed=21 nr_dirty=0 nr_writeback=0 nr_congested=0 nr_immediate=0 nr_activate_anon=0 nr_activate_file=0 nr_ref_keep=11 nr_unmap_fail=0 priority=6 flags=RECLAIM_WB_FILE|RECLAIM_WB_ASYNC > > Signed-off-by: Bixuan Cui <cuibixuan@xxxxxxxx> > Reviewed-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> > --- > Changes: > v5: * Use 'DECLARE_EVENT_CLASS(mm_vmscan_lru_shrink_start_template' to > replace 'RACE_EVENT(mm_vmscan_lru_shrink_inactive/active_start' > * Add the explanation for adding new shrink lru events into 'mm: vmscan: add new event to trace shrink lru' >From the tracing POV: Reviewed-by: Steven Rostedt (Google) <rostedt@xxxxxxxxxxx> -- Steve > v4: * Add Reviewed-by and Changlog to every patch. > v3: * Swap the positions of 'nid' and 'freeable' to prevent the hole in the trace event. > v2: * Modify trace_mm_vmscan_lru_shrink_inactive() in evict_folios() at the same time to fix build error (Andrew pointed out). > > include/trace/events/vmscan.h | 31 +++++++++++++++++++++++++++++-- > mm/vmscan.c | 11 ++++++++--- > 2 files changed, 37 insertions(+), 5 deletions(-) >