aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/trace/events/vmscan.h28
-rw-r--r--mm/vmscan.c20
2 files changed, 47 insertions, 1 deletions
diff --git a/include/trace/events/vmscan.h b/include/trace/events/vmscan.h
index f9f2747bc1c1..028733be4f34 100644
--- a/include/trace/events/vmscan.h
+++ b/include/trace/events/vmscan.h
@@ -117,6 +117,19 @@ DEFINE_EVENT(mm_vmscan_direct_reclaim_begin_template, mm_vmscan_direct_reclaim_b
117 TP_ARGS(order, may_writepage, gfp_flags) 117 TP_ARGS(order, may_writepage, gfp_flags)
118); 118);
119 119
120DEFINE_EVENT(mm_vmscan_direct_reclaim_begin_template, mm_vmscan_memcg_reclaim_begin,
121
122 TP_PROTO(int order, int may_writepage, gfp_t gfp_flags),
123
124 TP_ARGS(order, may_writepage, gfp_flags)
125);
126
127DEFINE_EVENT(mm_vmscan_direct_reclaim_begin_template, mm_vmscan_memcg_softlimit_reclaim_begin,
128
129 TP_PROTO(int order, int may_writepage, gfp_t gfp_flags),
130
131 TP_ARGS(order, may_writepage, gfp_flags)
132);
120 133
121DECLARE_EVENT_CLASS(mm_vmscan_direct_reclaim_end_template, 134DECLARE_EVENT_CLASS(mm_vmscan_direct_reclaim_end_template,
122 135
@@ -142,6 +155,21 @@ DEFINE_EVENT(mm_vmscan_direct_reclaim_end_template, mm_vmscan_direct_reclaim_end
142 TP_ARGS(nr_reclaimed) 155 TP_ARGS(nr_reclaimed)
143); 156);
144 157
158DEFINE_EVENT(mm_vmscan_direct_reclaim_end_template, mm_vmscan_memcg_reclaim_end,
159
160 TP_PROTO(unsigned long nr_reclaimed),
161
162 TP_ARGS(nr_reclaimed)
163);
164
165DEFINE_EVENT(mm_vmscan_direct_reclaim_end_template, mm_vmscan_memcg_softlimit_reclaim_end,
166
167 TP_PROTO(unsigned long nr_reclaimed),
168
169 TP_ARGS(nr_reclaimed)
170);
171
172
145TRACE_EVENT(mm_vmscan_lru_isolate, 173TRACE_EVENT(mm_vmscan_lru_isolate,
146 174
147 TP_PROTO(int order, 175 TP_PROTO(int order,
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 9789a2c92563..154b37a33731 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -1951,6 +1951,11 @@ unsigned long mem_cgroup_shrink_node_zone(struct mem_cgroup *mem,
1951 sc.nodemask = &nm; 1951 sc.nodemask = &nm;
1952 sc.nr_reclaimed = 0; 1952 sc.nr_reclaimed = 0;
1953 sc.nr_scanned = 0; 1953 sc.nr_scanned = 0;
1954
1955 trace_mm_vmscan_memcg_softlimit_reclaim_begin(0,
1956 sc.may_writepage,
1957 sc.gfp_mask);
1958
1954 /* 1959 /*
1955 * NOTE: Although we can get the priority field, using it 1960 * NOTE: Although we can get the priority field, using it
1956 * here is not a good idea, since it limits the pages we can scan. 1961 * here is not a good idea, since it limits the pages we can scan.
@@ -1959,6 +1964,9 @@ unsigned long mem_cgroup_shrink_node_zone(struct mem_cgroup *mem,
1959 * the priority and make it zero. 1964 * the priority and make it zero.
1960 */ 1965 */
1961 shrink_zone(0, zone, &sc); 1966 shrink_zone(0, zone, &sc);
1967
1968 trace_mm_vmscan_memcg_softlimit_reclaim_end(sc.nr_reclaimed);
1969
1962 return sc.nr_reclaimed; 1970 return sc.nr_reclaimed;
1963} 1971}
1964 1972
@@ -1968,6 +1976,7 @@ unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem_cont,
1968 unsigned int swappiness) 1976 unsigned int swappiness)
1969{ 1977{
1970 struct zonelist *zonelist; 1978 struct zonelist *zonelist;
1979 unsigned long nr_reclaimed;
1971 struct scan_control sc = { 1980 struct scan_control sc = {
1972 .may_writepage = !laptop_mode, 1981 .may_writepage = !laptop_mode,
1973 .may_unmap = 1, 1982 .may_unmap = 1,
@@ -1982,7 +1991,16 @@ unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem_cont,
1982 sc.gfp_mask = (gfp_mask & GFP_RECLAIM_MASK) | 1991 sc.gfp_mask = (gfp_mask & GFP_RECLAIM_MASK) |
1983 (GFP_HIGHUSER_MOVABLE & ~GFP_RECLAIM_MASK); 1992 (GFP_HIGHUSER_MOVABLE & ~GFP_RECLAIM_MASK);
1984 zonelist = NODE_DATA(numa_node_id())->node_zonelists; 1993 zonelist = NODE_DATA(numa_node_id())->node_zonelists;
1985 return do_try_to_free_pages(zonelist, &sc); 1994
1995 trace_mm_vmscan_memcg_reclaim_begin(0,
1996 sc.may_writepage,
1997 sc.gfp_mask);
1998
1999 nr_reclaimed = do_try_to_free_pages(zonelist, &sc);
2000
2001 trace_mm_vmscan_memcg_reclaim_end(nr_reclaimed);
2002
2003 return nr_reclaimed;
1986} 2004}
1987#endif 2005#endif
1988 2006