vmscan: tracing: add trace events for LRU page isolation
authorMel Gorman <mel@csn.ul.ie>
Tue, 10 Aug 2010 00:19:17 +0000 (17:19 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 10 Aug 2010 03:44:59 +0000 (20:44 -0700)
Add an event for when pages are isolated en-masse from the LRU lists.
This event augments the information available on LRU traffic and can be
used to evaluate lumpy reclaim.

[akpm@linux-foundation.org: coding-style fixes]
Signed-off-by: Mel Gorman <mel@csn.ul.ie>
Acked-by: Rik van Riel <riel@redhat.com>
Acked-by: Larry Woodman <lwoodman@redhat.com>
Cc: Dave Chinner <david@fromorbit.com>
Cc: Chris Mason <chris.mason@oracle.com>
Cc: Nick Piggin <npiggin@suse.de>
Cc: Rik van Riel <riel@redhat.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Michael Rubin <mrubin@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
include/trace/events/vmscan.h
mm/vmscan.c

index f76521ffe7dfa6449884f18c1d7155da86a4adaa..c0552be1f50acd04b530536e47091e09624377dc 100644 (file)
@@ -109,6 +109,52 @@ TRACE_EVENT(mm_vmscan_direct_reclaim_end,
        TP_printk("nr_reclaimed=%lu", __entry->nr_reclaimed)
 );
 
+TRACE_EVENT(mm_vmscan_lru_isolate,
+
+       TP_PROTO(int order,
+               unsigned long nr_requested,
+               unsigned long nr_scanned,
+               unsigned long nr_taken,
+               unsigned long nr_lumpy_taken,
+               unsigned long nr_lumpy_dirty,
+               unsigned long nr_lumpy_failed,
+               int isolate_mode),
+
+       TP_ARGS(order, nr_requested, nr_scanned, nr_taken, nr_lumpy_taken, nr_lumpy_dirty, nr_lumpy_failed, isolate_mode),
+
+       TP_STRUCT__entry(
+               __field(int, order)
+               __field(unsigned long, nr_requested)
+               __field(unsigned long, nr_scanned)
+               __field(unsigned long, nr_taken)
+               __field(unsigned long, nr_lumpy_taken)
+               __field(unsigned long, nr_lumpy_dirty)
+               __field(unsigned long, nr_lumpy_failed)
+               __field(int, isolate_mode)
+       ),
+
+       TP_fast_assign(
+               __entry->order = order;
+               __entry->nr_requested = nr_requested;
+               __entry->nr_scanned = nr_scanned;
+               __entry->nr_taken = nr_taken;
+               __entry->nr_lumpy_taken = nr_lumpy_taken;
+               __entry->nr_lumpy_dirty = nr_lumpy_dirty;
+               __entry->nr_lumpy_failed = nr_lumpy_failed;
+               __entry->isolate_mode = isolate_mode;
+       ),
+
+       TP_printk("isolate_mode=%d order=%d nr_requested=%lu nr_scanned=%lu nr_taken=%lu contig_taken=%lu contig_dirty=%lu contig_failed=%lu",
+               __entry->isolate_mode,
+               __entry->order,
+               __entry->nr_requested,
+               __entry->nr_scanned,
+               __entry->nr_taken,
+               __entry->nr_lumpy_taken,
+               __entry->nr_lumpy_dirty,
+               __entry->nr_lumpy_failed)
+);
+
 #endif /* _TRACE_VMSCAN_H */
 
 /* This part must be outside protection */
index c99bc418c4cf033559fa4fe274a10cdd2d8ea6c3..3d006d91a526a8dc36daff4a06e8b11acb201558 100644 (file)
@@ -919,6 +919,9 @@ static unsigned long isolate_lru_pages(unsigned long nr_to_scan,
                unsigned long *scanned, int order, int mode, int file)
 {
        unsigned long nr_taken = 0;
+       unsigned long nr_lumpy_taken = 0;
+       unsigned long nr_lumpy_dirty = 0;
+       unsigned long nr_lumpy_failed = 0;
        unsigned long scan;
 
        for (scan = 0; scan < nr_to_scan && !list_empty(src); scan++) {
@@ -996,12 +999,25 @@ static unsigned long isolate_lru_pages(unsigned long nr_to_scan,
                                list_move(&cursor_page->lru, dst);
                                mem_cgroup_del_lru(cursor_page);
                                nr_taken++;
+                               nr_lumpy_taken++;
+                               if (PageDirty(cursor_page))
+                                       nr_lumpy_dirty++;
                                scan++;
+                       } else {
+                               if (mode == ISOLATE_BOTH &&
+                                               page_count(cursor_page))
+                                       nr_lumpy_failed++;
                        }
                }
        }
 
        *scanned = scan;
+
+       trace_mm_vmscan_lru_isolate(order,
+                       nr_to_scan, scan,
+                       nr_taken,
+                       nr_lumpy_taken, nr_lumpy_dirty, nr_lumpy_failed,
+                       mode);
        return nr_taken;
 }