summaryrefslogtreecommitdiff
path: root/mm
diff options
context:
space:
mode:
authorGanesh Mahendran <opensource.ganesh@gmail.com>2016-10-12 08:56:10 +0200
committerMichal Hocko <mhocko@suse.com>2016-10-12 08:56:10 +0200
commitfbeb3e16579a8e4d04a14a9e18f2a64b8b488c7a (patch)
tree5abff7db45fd48f7f7ea6b14c6c53551df228e2d /mm
parenta40ff2020bb179e1510f1ac5ce7cdb546d1a9666 (diff)
mm/zsmalloc: add trace events for zs_compact
Currently zsmalloc is widely used in android device. Sometimes, we want to see how frequently zs_compact is triggered or how may pages freed by zs_compact(), or which zsmalloc pool is compacted. We have backported the zs_compact() to our product(kernel 3.18). It is usefull for a longtime running device. But there is not a convenient way to get the detailed information of zs_comapct() which is usefull for performance optimization. Information about how much time zs_compact used, which pool is compacted, how many page freed, etc. With these information, we will know what is going on in zs_comapct. And draw the relation between free mem and zs_comapct. Most of the time, user can get the brief information from trace_mm_shrink_slab_[start | end], but in some senario, they do not use zsmalloc shrinker, but trigger compaction manually. So add some trace events in zs_compact is convenient. Also we can add some zsmalloc specific information(pool name, total compact pages, etc) in zsmalloc trace. This patch add two trace events for zs_compact(), below the trace log: ----------------------------- root@land:/ # cat /d/tracing/trace kswapd0-125 [007] ...1 174.176979: zsmalloc_compact_start: pool zram0 kswapd0-125 [007] ...1 174.181967: zsmalloc_compact_end: pool zram0: 608 pages compacted(total 1794) kswapd0-125 [000] ...1 184.134475: zsmalloc_compact_start: pool zram0 kswapd0-125 [000] ...1 184.135010: zsmalloc_compact_end: pool zram0: 62 pages compacted(total 1856) kswapd0-125 [003] ...1 226.927221: zsmalloc_compact_start: pool zram0 kswapd0-125 [003] ...1 226.928575: zsmalloc_compact_end: pool zram0: 250 pages compacted(total 2106) ----------------------------- Link: http://lkml.kernel.org/r/1465289804-4913-1-git-send-email-opensource.ganesh@gmail.com Signed-off-by: Ganesh Mahendran <opensource.ganesh@gmail.com> Cc: Minchan Kim <minchan@kernel.org> Cc: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Ingo Molnar <mingo@elte.hu> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/zsmalloc.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
index b0bc023d25c5..10e15e884ca9 100644
--- a/mm/zsmalloc.c
+++ b/mm/zsmalloc.c
@@ -31,6 +31,8 @@
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+#define CREATE_TRACE_POINTS
+
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/sched.h>
@@ -53,6 +55,7 @@
#include <linux/mount.h>
#include <linux/migrate.h>
#include <linux/pagemap.h>
+#include <trace/events/zsmalloc.h>
#define ZSPAGE_MAGIC 0x58
@@ -2309,6 +2312,9 @@ unsigned long zs_compact(struct zs_pool *pool)
{
int i;
struct size_class *class;
+ unsigned long pages_compacted_before = pool->stats.pages_compacted;
+
+ trace_zsmalloc_compact_start(pool->name);
for (i = zs_size_classes - 1; i >= 0; i--) {
class = pool->size_class[i];
@@ -2319,6 +2325,10 @@ unsigned long zs_compact(struct zs_pool *pool)
__zs_compact(pool, class);
}
+ trace_zsmalloc_compact_end(pool->name,
+ pool->stats.pages_compacted - pages_compacted_before,
+ pool->stats.pages_compacted);
+
return pool->stats.pages_compacted;
}
EXPORT_SYMBOL_GPL(zs_compact);