The commit is pushed to "branch-rh7-3.10.0-693.11.6.vz7.42.x-ovz" and will 
appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-693.11.6.vz7.42.4
------>
commit 4080c5a6e3398ba43de798e30e7ef69018abd2e3
Author: Michal Hocko <mho...@suse.com>
Date:   Wed Jan 31 18:29:30 2018 +0300

    ms/mm, vmscan: add active list aging tracepoint
    
    Our reclaim process has several tracepoints to tell us more about how
    things are progressing.  We are, however, missing a tracepoint to track
    active list aging.  Introduce mm_vmscan_lru_shrink_active which reports
    the number of
    
            - nr_taken is number of isolated pages from the active list
            - nr_referenced pages which tells us that we are hitting referenced
              pages which are deactivated. If this is a large part of the
              reported nr_deactivated pages then we might be hitting into
              the active list too early because they might be still part of
              the working set. This might help to debug performance issues.
            - nr_active pages which tells us how many pages are kept on the
              active list - mostly exec file backed pages. A high number can
              indicate that we might be trashing on executables.
    
    [mho...@suse.com: update]
      Link: http://lkml.kernel.org/r/20170104135244.gj25...@dhcp22.suse.cz
    Link: http://lkml.kernel.org/r/20170104101942.4860-3-mho...@kernel.org
    Signed-off-by: Michal Hocko <mho...@suse.com>
    Acked-by: Hillf Danton <hillf...@alibaba-inc.com>
    Acked-by: Mel Gorman <mgor...@suse.de>
    Acked-by: Minchan Kim <minc...@kernel.org>
    Acked-by: Vlastimil Babka <vba...@suse.cz>
    Signed-off-by: Andrew Morton <a...@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torva...@linux-foundation.org>
    
    https://jira.sw.ru/browse/PSBM-61409
    (cherry-picked from 9d998b4f1e39abd69441d29a1ef3250514479267)
    Signed-off-by: Andrey Ryabinin <aryabi...@virtuozzo.com>
---
 include/trace/events/vmscan.h | 36 ++++++++++++++++++++++++++++++++++++
 mm/vmscan.c                   | 19 +++++++++++++++----
 2 files changed, 51 insertions(+), 4 deletions(-)

diff --git a/include/trace/events/vmscan.h b/include/trace/events/vmscan.h
index d98fb0ab1831..9b64323db0e0 100644
--- a/include/trace/events/vmscan.h
+++ b/include/trace/events/vmscan.h
@@ -374,6 +374,42 @@ TRACE_EVENT(mm_vmscan_lru_shrink_inactive,
                show_reclaim_flags(__entry->reclaim_flags))
 );
 
+TRACE_EVENT(mm_vmscan_lru_shrink_active,
+
+       TP_PROTO(int nid, unsigned long nr_taken,
+               unsigned long nr_active, unsigned long nr_deactivated,
+               unsigned long nr_referenced, int priority, int file),
+
+       TP_ARGS(nid, nr_taken, nr_active, nr_deactivated, nr_referenced, 
priority, file),
+
+       TP_STRUCT__entry(
+               __field(int, nid)
+               __field(unsigned long, nr_taken)
+               __field(unsigned long, nr_active)
+               __field(unsigned long, nr_deactivated)
+               __field(unsigned long, nr_referenced)
+               __field(int, priority)
+               __field(int, reclaim_flags)
+       ),
+
+       TP_fast_assign(
+               __entry->nid = nid;
+               __entry->nr_taken = nr_taken;
+               __entry->nr_active = nr_active;
+               __entry->nr_deactivated = nr_deactivated;
+               __entry->nr_referenced = nr_referenced;
+               __entry->priority = priority;
+               __entry->reclaim_flags = trace_shrink_flags(file);
+       ),
+
+       TP_printk("nid=%d nr_taken=%ld nr_active=%ld nr_deactivated=%ld 
nr_referenced=%ld priority=%d flags=%s",
+               __entry->nid,
+               __entry->nr_taken,
+               __entry->nr_active, __entry->nr_deactivated, 
__entry->nr_referenced,
+               __entry->priority,
+               show_reclaim_flags(__entry->reclaim_flags))
+);
+
 #endif /* _TRACE_VMSCAN_H */
 
 /* This part must be outside protection */
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 0856721124c9..3f0a7a1e27ff 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -1685,9 +1685,11 @@ shrink_inactive_list(unsigned long nr_to_scan, struct 
lruvec *lruvec,
  *
  * The downside is that we have to touch page->_count against each page.
  * But we had to alter page->flags anyway.
+ *
+ * Returns the number of pages moved to the given lru.
  */
 
-static void move_active_pages_to_lru(struct lruvec *lruvec,
+static unsigned move_active_pages_to_lru(struct lruvec *lruvec,
                                     struct list_head *list,
                                     struct list_head *pages_to_free,
                                     enum lru_list lru)
@@ -1696,6 +1698,7 @@ static void move_active_pages_to_lru(struct lruvec 
*lruvec,
        unsigned long pgmoved = 0;
        struct page *page;
        int nr_pages;
+       int nr_moved = 0;
 
        while (!list_empty(list)) {
                page = lru_to_page(list);
@@ -1721,11 +1724,15 @@ static void move_active_pages_to_lru(struct lruvec 
*lruvec,
                                spin_lock_irq(&zone->lru_lock);
                        } else
                                list_add(&page->lru, pages_to_free);
+               } else {
+                       nr_moved += nr_pages;
                }
        }
        __mod_zone_page_state(zone, NR_LRU_BASE + lru, pgmoved);
        if (!is_active_lru(lru))
                __count_vm_events(PGDEACTIVATE, pgmoved);
+
+       return nr_moved;
 }
 
 static void shrink_active_list(unsigned long nr_to_scan,
@@ -1741,7 +1748,8 @@ static void shrink_active_list(unsigned long nr_to_scan,
        LIST_HEAD(l_inactive);
        struct page *page;
        struct zone_reclaim_stat *reclaim_stat = &lruvec->reclaim_stat;
-       unsigned long nr_rotated = 0;
+       unsigned nr_deactivate, nr_activate;
+       unsigned nr_rotated = 0;
        isolate_mode_t isolate_mode = 0;
        int file = is_file_lru(lru);
        struct zone *zone = lruvec_zone(lruvec);
@@ -1821,8 +1829,8 @@ static void shrink_active_list(unsigned long nr_to_scan,
         */
        reclaim_stat->recent_rotated[file] += nr_rotated;
 
-       move_active_pages_to_lru(lruvec, &l_active, &l_hold, lru);
-       move_active_pages_to_lru(lruvec, &l_inactive, &l_hold, lru - 
LRU_ACTIVE);
+       nr_activate = move_active_pages_to_lru(lruvec, &l_active, &l_hold, lru);
+       nr_deactivate = move_active_pages_to_lru(lruvec, &l_inactive, &l_hold, 
lru - LRU_ACTIVE);
        __mod_zone_page_state(zone, NR_ISOLATED_ANON + file, -nr_taken);
        spin_unlock_irq(&zone->lru_lock);
 
@@ -1830,6 +1838,9 @@ static void shrink_active_list(unsigned long nr_to_scan,
        free_hot_cold_page_list(&l_hold, true);
 
        KSTAT_PERF_LEAVE(refill_inact);
+
+       trace_mm_vmscan_lru_shrink_active(zone_to_nid(zone), nr_taken, 
nr_activate,
+                       nr_deactivate, nr_rotated, sc->priority, file);
 }
 
 
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to