memcg reclaim tracepoint v2
Subsystems (5)
cover memcg reclaim tracepoint v2
Recently, Mel Gorman added some vmscan tracepoint. but they can't trace memcg. So, This patch series does.
Changelog since v1
o drop all memcg bugfix and cleanups
diffstat
=========================
KOSAKI Motohiro (4):
vmscan: convert direct reclaim tracepoint to DEFINE_TRACE memcg, vmscan: add memcg reclaim tracepoint
vmscan: convert mm_vmscan_lru_isolate to DEFINE_EVENT
memcg: add mm_vmscan_memcg_isolate tracepoint
include/trace/events/vmscan.h | 79 +++++++++++++++++++++++++++++++++++++++-- mm/memcontrol.c | 6 +++ mm/vmscan.c | 20 ++++++++++- 3 files changed, 101 insertions(+), 4 deletions(-)
Sameple output is here.
=========================
dd-1851 [001] 158.837763: mm_vmscan_memcg_reclaim_begin: order=0 may_writepage=1 gfp_flags=GFP_HIGHUSER_MOVABLE
dd-1851 [001] 158.837783: mm_vmscan_memcg_isolate: isolate_mode=0 order=0 nr_requested=32 nr_scanned=32 nr_taken=32 contig_taken=0 contig_dirty=0 contig_failed=0
dd-1851 [001] 158.837860: mm_vmscan_memcg_reclaim_end: nr_reclaimed=32
(...)
dd-1970 [000] 266.608235: mm_vmscan_wakeup_kswapd: nid=0 zid=1 order=0
dd-1970 [000] 266.608239: mm_vmscan_wakeup_kswapd: nid=1 zid=1 order=0
dd-1970 [000] 266.608248: mm_vmscan_wakeup_kswapd: nid=2 zid=1 order=0
kswapd1-348 [001] 266.608254: mm_vmscan_kswapd_wake: nid=1 order=0
dd-1970 [000] 266.608254: mm_vmscan_wakeup_kswapd: nid=3 zid=1 order=0
kswapd3-350 [000] 266.608266: mm_vmscan_kswapd_wake: nid=3 order=0
(...)
kswapd0-347 [001] 267.328891: mm_vmscan_memcg_softlimit_reclaim_begin: order=0 may_writepage=1 gfp_flags=GFP_HIGHUSER_MOVABLE
kswapd0-347 [001] 267.328897: mm_vmscan_memcg_isolate: isolate_mode=0 order=0 nr_requested=32 nr_scanned=32 nr_taken=32 contig_taken=0 contig_dirty=0 contig_failed=0
kswapd0-347 [001] 267.328915: mm_vmscan_memcg_isolate: isolate_mode=0 order=0 nr_requested=32 nr_scanned=32 nr_taken=32 contig_taken=0 contig_dirty=0 contig_failed=0
kswapd0-347 [001] 267.328989: mm_vmscan_memcg_softlimit_reclaim_end: nr_reclaimed=32
kswapd0-347 [001] 267.329019: mm_vmscan_lru_isolate: isolate_mode=1 order=0 nr_requested=32 nr_scanned=32 nr_taken=32 contig_taken=0 contig_dirty=0 contig_failed=0
kswapd0-347 [001] 267.330562: mm_vmscan_lru_isolate: isolate_mode=1 order=0 nr_requested=32 nr_scanned=32 nr_taken=32 contig_taken=0 contig_dirty=0 contig_failed=0
(...)
kswapd2-349 [001] 267.407081: mm_vmscan_kswapd_sleep: nid=2
kswapd3-350 [001] 267.408077: mm_vmscan_kswapd_sleep: nid=3
kswapd1-348 [000] 267.427858: mm_vmscan_kswapd_sleep: nid=1
kswapd0-347 [001] 267.430064: mm_vmscan_kswapd_sleep: nid=0PATCH 1/4 vmscan: convert direct reclaim tracepoint to DEFINE_TRACE
Mel Gorman recently added some vmscan tracepoints. Unfortunately they are covered only global reclaim. But we want to trace memcg reclaim too.
Thus, this patch convert them to DEFINE_TRACE macro. it help to reuse tracepoint definition for other similar usage (i.e. memcg). This patch have no functionally change.
--- include/trace/events/vmscan.h | 19 +++++++++++++++++-- 1 files changed, 17 insertions(+), 2 deletions(-)
include/trace/events/vmscan.h +17 -2
@@ -68,7 +68,7 @@ TRACE_EVENT(mm_vmscan_wakeup_kswapd, __entry->order) ); -TRACE_EVENT(mm_vmscan_direct_reclaim_begin, +DECLARE_EVENT_CLASS(mm_vmscan_direct_reclaim_begin_template, TP_PROTO(int order, int may_writepage, gfp_t gfp_flags),
@@ -92,7 +92,15 @@ TRACE_EVENT(mm_vmscan_direct_reclaim_begin, show_gfp_flags(__entry->gfp_flags)) ); -TRACE_EVENT(mm_vmscan_direct_reclaim_end, +DEFINE_EVENT (mm_vmscan_direct_reclaim_begin_template, mm_vmscan_direct_reclaim_begin, + + TP_PROTO(int order, int may_writepage, gfp_t gfp_flags), + +TP_ARGS (order, may_writepage, gfp_flags) +); + + +DECLARE_EVENT_CLASS(mm_vmscan_direct_reclaim_end_template, TP_PROTO(unsigned long nr_reclaimed),
@@ -109,6 +117,13 @@ TRACE_EVENT(mm_vmscan_direct_reclaim_end,TP_printk ("nr_reclaimed=%lu" , __entry->nr_reclaimed) ); +DEFINE_EVENT (mm_vmscan_direct_reclaim_end_template, mm_vmscan_direct_reclaim_end, + + TP_PROTO(unsigned long nr_reclaimed), + +TP_ARGS (nr_reclaimed) +); + TRACE_EVENT(mm_vmscan_lru_isolate, TP_PROTO(int order,
Signature · 9 lines
1.6.5.2 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 1/4] vmscan: convert direct reclaim tracepoint to DEFINE_TRACE
Quoted 10 lines · KOSAKI Motohiro
Mel Gorman recently added some vmscan tracepoints. Unfortunately they are covered only global reclaim. But we want to trace memcg reclaim too.
Thus, this patch convert them to
DEFINE_TRACEmacro. it help to reuse tracepoint definition for other similar usage (i.e. memcg). This patch have no functionally change.Signed-off-by KOSAKI Motohiro <[email protected]>Reviewed-by KAMEZAWA Hiroyuki <[email protected]>Acked-by Mel Gorman <[email protected]>
Balbir
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 2/4 memcg, vmscan: add memcg reclaim tracepoint
In reply to KOSAKI MotohiroMemcg also need to trace reclaim progress as direct reclaim. This patch add it.
--- include/trace/events/vmscan.h | 28 ++++++++++++++++++++++++++++ mm/vmscan.c | 20 +++++++++++++++++++- 2 files changed, 47 insertions(+), 1 deletions(-)
include/trace/events/vmscan.h +28 -0
@@ -99,6 +99,19 @@ DEFINE_EVENT(mm_vmscan_direct_reclaim_begin_template, mm_vmscan_direct_reclaim_bTP_ARGS (order, may_writepage, gfp_flags) ); +DEFINE_EVENT (mm_vmscan_direct_reclaim_begin_template, mm_vmscan_memcg_reclaim_begin, + + TP_PROTO(int order, int may_writepage, gfp_t gfp_flags), + +TP_ARGS (order, may_writepage, gfp_flags) +); + +DEFINE_EVENT (mm_vmscan_direct_reclaim_begin_template, mm_vmscan_memcg_softlimit_reclaim_begin, + + TP_PROTO(int order, int may_writepage, gfp_t gfp_flags), + +TP_ARGS (order, may_writepage, gfp_flags) +); DECLARE_EVENT_CLASS(mm_vmscan_direct_reclaim_end_template,
@@ -124,6 +137,21 @@ DEFINE_EVENT(mm_vmscan_direct_reclaim_end_template, mm_vmscan_direct_reclaim_endTP_ARGS (nr_reclaimed) ); +DEFINE_EVENT (mm_vmscan_direct_reclaim_end_template, mm_vmscan_memcg_reclaim_end, + + TP_PROTO(unsigned long nr_reclaimed), + +TP_ARGS (nr_reclaimed) +); + +DEFINE_EVENT (mm_vmscan_direct_reclaim_end_template, mm_vmscan_memcg_softlimit_reclaim_end, + + TP_PROTO(unsigned long nr_reclaimed), + +TP_ARGS (nr_reclaimed) +); + + TRACE_EVENT(mm_vmscan_lru_isolate, TP_PROTO(int order,
mm/vmscan.c +19 -1
@@ -1949,6 +1949,11 @@ unsigned long mem_cgroup_shrink_node_zone(struct mem_cgroup *mem, sc.nodemask = &nm; sc.nr_reclaimed =0 ; sc.nr_scanned =0 ; + +trace_mm_vmscan_memcg_softlimit_reclaim_begin (0 , + sc.may_writepage, + sc.gfp_mask); +/* * NOTE: Although we can get the priority field, using it * here is not a good idea, since it limits the pages we can scan.
@@ -1957,6 +1962,9 @@ unsigned long mem_cgroup_shrink_node_zone(struct mem_cgroup *mem,* the priority and make it zero. */ shrink_zone (0 , zone, &sc); + +trace_mm_vmscan_memcg_softlimit_reclaim_end (sc.nr_reclaimed); +return sc.nr_reclaimed; }
@@ -1966,6 +1974,7 @@ unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem_cont, unsigned int swappiness) {struct zonelist *zonelist; +unsigned long nr_reclaimed;struct scan_control sc = { .may_writepage = !laptop_mode, .may_unmap =1 ,
@@ -1980,7 +1989,16 @@ unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem_cont, sc.gfp_mask = (gfp_mask &GFP_RECLAIM_MASK ) | (GFP_HIGHUSER_MOVABLE & ~GFP_RECLAIM_MASK ); zonelist =NODE_DATA (numa_node_id ())->node_zonelists; - return do_try_to_free_pages(zonelist, &sc); + +trace_mm_vmscan_memcg_reclaim_begin (0 , + sc.may_writepage, + sc.gfp_mask); + + nr_reclaimed =do_try_to_free_pages (zonelist, &sc); + +trace_mm_vmscan_memcg_reclaim_end (nr_reclaimed); + + return nr_reclaimed; }#endif
Signature · 9 lines
1.6.5.2 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 3/4 vmscan: convert mm_vmscan_lru_isolate to DEFINE_EVENT
In reply to KOSAKI MotohiroMel Gorman recently added some vmscan tracepoints. Unfortunately they are covered only global reclaim. But we want to trace memcg reclaim too.
Thus, this patch convert them to DEFINE_TRACE macro. it help to reuse tracepoint definition for other similar usage (i.e. memcg). This patch have no functionally change.
--- include/trace/events/vmscan.h | 17 ++++++++++++++++- 1 files changed, 16 insertions(+), 1 deletions(-)
include/trace/events/vmscan.h +16 -1
@@ -152,7 +152,7 @@ DEFINE_EVENT(mm_vmscan_direct_reclaim_end_template, mm_vmscan_memcg_softlimit_re ); -TRACE_EVENT(mm_vmscan_lru_isolate, +DECLARE_EVENT_CLASS(mm_vmscan_lru_isolate_template, TP_PROTO(int order, unsigned long nr_requested,
@@ -198,6 +198,21 @@ TRACE_EVENT(mm_vmscan_lru_isolate, __entry->nr_lumpy_failed) ); +DEFINE_EVENT (mm_vmscan_lru_isolate_template, 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) + +); + TRACE_EVENT(mm_vmscan_writepage, TP_PROTO(struct page *page,
Signature · 9 lines
1.6.5.2 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 3/4] vmscan: convert mm_vmscan_lru_isolate to DEFINE_EVENT
Quoted 10 lines · KOSAKI Motohiro
Mel Gorman recently added some vmscan tracepoints. Unfortunately they are covered only global reclaim. But we want to trace memcg reclaim too.
Thus, this patch convert them to
DEFINE_TRACEmacro. it help to reuse tracepoint definition for other similar usage (i.e. memcg). This patch have no functionally change.Signed-off-by KOSAKI Motohiro <[email protected]>Reviewed-by KAMEZAWA Hiroyuki <[email protected]>
Balbir
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 3/4] vmscan: convert mm_vmscan_lru_isolate to DEFINE_EVENT
In reply to KOSAKI MotohiroQuoted 10 lines · KOSAKI Motohiro
Mel Gorman recently added some vmscan tracepoints. Unfortunately they are covered only global reclaim. But we want to trace memcg reclaim too.
Thus, this patch convert them to
DEFINE_TRACEmacro. it help to reuse tracepoint definition for other similar usage (i.e. memcg). This patch have no functionally change.Signed-off-by KOSAKI Motohiro <[email protected]>Reviewed-by KAMEZAWA Hiroyuki <[email protected]>
Signature · 3 lines
Mel Gorman Part-time Phd Student Linux Technology Center University of Limerick IBM Dublin Software Lab
PATCH 4/4 memcg: add mm_vmscan_memcg_isolate tracepoint
In reply to KOSAKI MotohiroMemcg also need to trace page isolation information as global reclaim. This patch does it.
--- include/trace/events/vmscan.h | 15 +++++++++++++++ mm/memcontrol.c | 6 ++++++ 2 files changed, 21 insertions(+), 0 deletions(-)
include/trace/events/vmscan.h +15 -0
@@ -213,6 +213,21 @@ DEFINE_EVENT(mm_vmscan_lru_isolate_template, mm_vmscan_lru_isolate, ); +DEFINE_EVENT (mm_vmscan_lru_isolate_template, mm_vmscan_memcg_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) + +); + TRACE_EVENT(mm_vmscan_writepage, TP_PROTO(struct page *page,
mm/memcontrol.c +6 -0
@@ -52,6 +52,8 @@#include <asm/uaccess.h> +#include <trace/events/vmscan.h> +struct cgroup_subsys mem_cgroup_subsys__read_mostly ;#define MEM_CGROUP_RECLAIM_RETRIES 5struct mem_cgroup *root_mem_cgroup__read_mostly ;
@@ -1011,6 +1013,10 @@ unsigned long mem_cgroup_isolate_pages(unsigned long nr_to_scan, } *scanned = scan; + +trace_mm_vmscan_memcg_isolate (0 , nr_to_scan, scan, nr_taken, +0 ,0 ,0 , mode); +return nr_taken; }
Signature · 9 lines
1.6.5.2 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 4/4] memcg: add mm_vmscan_memcg_isolate tracepoint
Quoted 5 lines · KOSAKI Motohiro
Memcg also need to trace page isolation information as global reclaim. This patch does it.
Signed-off-by KOSAKI Motohiro <[email protected]>Reviewed-by KAMEZAWA Hiroyuki <[email protected]>
Balbir
Re: [PATCH 4/4] memcg: add mm_vmscan_memcg_isolate tracepoint
In reply to KOSAKI MotohiroQuoted 5 lines · KOSAKI Motohiro
Memcg also need to trace page isolation information as global reclaim. This patch does it.
Signed-off-by KOSAKI Motohiro <[email protected]>Reviewed-by KAMEZAWA Hiroyuki <[email protected]>
Signature · 3 lines
Mel Gorman Part-time Phd Student Linux Technology Center University of Limerick IBM Dublin Software Lab
Quoted 4 lines · KOSAKI Motohiro
Recently, Mel Gorman added some vmscan tracepoint. but they can't trace memcg. So, This patch series does.
The overall series looks good to me, acking the approach and the need for these patches