From: Minchan Kim <minchan@kernel.org>
To: Ganesh Mahendran <opensource.ganesh@gmail.com>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
akpm@linux-foundation.org, ngupta@vflare.org,
sergey.senozhatsky.work@gmail.com, rostedt@goodmis.org,
mingo@redhat.com
Subject: Re: [PATCH v3 8/8] mm/zsmalloc: add per-class compact trace event
Date: Thu, 7 Jul 2016 16:44:20 +0900 [thread overview]
Message-ID: <20160707074420.GE18072@bbox> (raw)
In-Reply-To: <1467786233-4481-8-git-send-email-opensource.ganesh@gmail.com>
Hello Ganesh,
On Wed, Jul 06, 2016 at 02:23:53PM +0800, Ganesh Mahendran wrote:
> add per-class compact trace event to get scanned objects and freed pages
> number.
> trace log is like below:
> ----
> kswapd0-629 [001] .... 293.161053: zs_compact_start: pool zram0
> kswapd0-629 [001] .... 293.161056: zs_compact: class 254: 0 objects scanned, 0 pages freed
> kswapd0-629 [001] .... 293.161057: zs_compact: class 202: 0 objects scanned, 0 pages freed
> kswapd0-629 [001] .... 293.161062: zs_compact: class 190: 1 objects scanned, 3 pages freed
> kswapd0-629 [001] .... 293.161063: zs_compact: class 168: 0 objects scanned, 0 pages freed
> kswapd0-629 [001] .... 293.161065: zs_compact: class 151: 0 objects scanned, 0 pages freed
> kswapd0-629 [001] .... 293.161073: zs_compact: class 144: 4 objects scanned, 8 pages freed
> kswapd0-629 [001] .... 293.161087: zs_compact: class 126: 20 objects scanned, 10 pages freed
> kswapd0-629 [001] .... 293.161095: zs_compact: class 111: 6 objects scanned, 8 pages freed
> kswapd0-629 [001] .... 293.161122: zs_compact: class 107: 27 objects scanned, 27 pages freed
> kswapd0-629 [001] .... 293.161157: zs_compact: class 100: 36 objects scanned, 24 pages freed
> kswapd0-629 [001] .... 293.161173: zs_compact: class 94: 10 objects scanned, 15 pages freed
> kswapd0-629 [001] .... 293.161221: zs_compact: class 91: 30 objects scanned, 40 pages freed
> kswapd0-629 [001] .... 293.161256: zs_compact: class 83: 120 objects scanned, 30 pages freed
> kswapd0-629 [001] .... 293.161266: zs_compact: class 76: 8 objects scanned, 8 pages freed
> kswapd0-629 [001] .... 293.161282: zs_compact: class 74: 20 objects scanned, 15 pages freed
> kswapd0-629 [001] .... 293.161306: zs_compact: class 71: 40 objects scanned, 20 pages freed
> kswapd0-629 [001] .... 293.161313: zs_compact: class 67: 8 objects scanned, 6 pages freed
> ...
> kswapd0-629 [001] .... 293.161454: zs_compact: class 0: 0 objects scanned, 0 pages freed
> kswapd0-629 [001] .... 293.161455: zs_compact_end: pool zram0: 301 pages compacted
> ----
>
> Also this patch changes trace_zsmalloc_compact_start[end] to
> trace_zs_compact_start[end] to keep function naming consistent
> with others in zsmalloc.
>
> Signed-off-by: Ganesh Mahendran <opensource.ganesh@gmail.com>
> ----
> v3:
> add per-class compact trace event - Minchan
>
> I put this patch from 1/8 to 8/8, since this patch depends on below patch:
> mm/zsmalloc: use obj_index to keep consistent with others
> mm/zsmalloc: take obj index back from find_alloced_obj
>
Thanks for looking into this, Ganesh!
Small change I want is to see the number of migrated object rather than
the number of scanning object.
If you don't mind, could you resend it with below?
Thanks.
diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
index 3a1315e54057..166232a0aed6 100644
--- a/mm/zsmalloc.c
+++ b/mm/zsmalloc.c
@@ -1774,7 +1774,7 @@ struct zs_compact_control {
* in the subpage. */
int obj_idx;
- unsigned long nr_scanned_obj;
+ unsigned long nr_migrated_obj;
unsigned long nr_freed_pages;
};
@@ -1809,6 +1809,7 @@ static int migrate_zspage(struct zs_pool *pool, struct size_class *class,
free_obj = obj_malloc(class, get_zspage(d_page), handle);
zs_object_copy(class, free_obj, used_obj);
obj_idx++;
+ cc->nr_migrated_obj++;
/*
* record_obj updates handle's value to free_obj and it will
* invalidate lock bit(ie, HANDLE_PIN_BIT) of handle, which
@@ -1821,8 +1822,6 @@ static int migrate_zspage(struct zs_pool *pool, struct size_class *class,
obj_free(class, used_obj);
}
- cc->nr_scanned_obj += obj_idx - cc->obj_idx;
-
/* Remember last position in this iteration */
cc->s_page = s_page;
cc->obj_idx = obj_idx;
@@ -2270,7 +2269,7 @@ static unsigned long zs_can_compact(struct size_class *class)
static void __zs_compact(struct zs_pool *pool, struct size_class *class)
{
struct zs_compact_control cc = {
- .nr_scanned_obj = 0,
+ .nr_migrated_obj = 0,
.nr_freed_pages = 0,
};
struct zspage *src_zspage;
@@ -2317,7 +2316,7 @@ static void __zs_compact(struct zs_pool *pool, struct size_class *class)
spin_unlock(&class->lock);
pool->stats.pages_compacted += cc.nr_freed_pages;
- trace_zs_compact(class->index, cc.nr_scanned_obj, cc.nr_freed_pages);
+ trace_zs_compact(class->index, cc.nr_migrated_obj, cc.nr_freed_pages);
}
unsigned long zs_compact(struct zs_pool *pool)
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
WARNING: multiple messages have this Message-ID (diff)
From: Minchan Kim <minchan@kernel.org>
To: Ganesh Mahendran <opensource.ganesh@gmail.com>
Cc: <linux-kernel@vger.kernel.org>, <linux-mm@kvack.org>,
<akpm@linux-foundation.org>, <ngupta@vflare.org>,
<sergey.senozhatsky.work@gmail.com>, <rostedt@goodmis.org>,
<mingo@redhat.com>
Subject: Re: [PATCH v3 8/8] mm/zsmalloc: add per-class compact trace event
Date: Thu, 7 Jul 2016 16:44:20 +0900 [thread overview]
Message-ID: <20160707074420.GE18072@bbox> (raw)
In-Reply-To: <1467786233-4481-8-git-send-email-opensource.ganesh@gmail.com>
Hello Ganesh,
On Wed, Jul 06, 2016 at 02:23:53PM +0800, Ganesh Mahendran wrote:
> add per-class compact trace event to get scanned objects and freed pages
> number.
> trace log is like below:
> ----
> kswapd0-629 [001] .... 293.161053: zs_compact_start: pool zram0
> kswapd0-629 [001] .... 293.161056: zs_compact: class 254: 0 objects scanned, 0 pages freed
> kswapd0-629 [001] .... 293.161057: zs_compact: class 202: 0 objects scanned, 0 pages freed
> kswapd0-629 [001] .... 293.161062: zs_compact: class 190: 1 objects scanned, 3 pages freed
> kswapd0-629 [001] .... 293.161063: zs_compact: class 168: 0 objects scanned, 0 pages freed
> kswapd0-629 [001] .... 293.161065: zs_compact: class 151: 0 objects scanned, 0 pages freed
> kswapd0-629 [001] .... 293.161073: zs_compact: class 144: 4 objects scanned, 8 pages freed
> kswapd0-629 [001] .... 293.161087: zs_compact: class 126: 20 objects scanned, 10 pages freed
> kswapd0-629 [001] .... 293.161095: zs_compact: class 111: 6 objects scanned, 8 pages freed
> kswapd0-629 [001] .... 293.161122: zs_compact: class 107: 27 objects scanned, 27 pages freed
> kswapd0-629 [001] .... 293.161157: zs_compact: class 100: 36 objects scanned, 24 pages freed
> kswapd0-629 [001] .... 293.161173: zs_compact: class 94: 10 objects scanned, 15 pages freed
> kswapd0-629 [001] .... 293.161221: zs_compact: class 91: 30 objects scanned, 40 pages freed
> kswapd0-629 [001] .... 293.161256: zs_compact: class 83: 120 objects scanned, 30 pages freed
> kswapd0-629 [001] .... 293.161266: zs_compact: class 76: 8 objects scanned, 8 pages freed
> kswapd0-629 [001] .... 293.161282: zs_compact: class 74: 20 objects scanned, 15 pages freed
> kswapd0-629 [001] .... 293.161306: zs_compact: class 71: 40 objects scanned, 20 pages freed
> kswapd0-629 [001] .... 293.161313: zs_compact: class 67: 8 objects scanned, 6 pages freed
> ...
> kswapd0-629 [001] .... 293.161454: zs_compact: class 0: 0 objects scanned, 0 pages freed
> kswapd0-629 [001] .... 293.161455: zs_compact_end: pool zram0: 301 pages compacted
> ----
>
> Also this patch changes trace_zsmalloc_compact_start[end] to
> trace_zs_compact_start[end] to keep function naming consistent
> with others in zsmalloc.
>
> Signed-off-by: Ganesh Mahendran <opensource.ganesh@gmail.com>
> ----
> v3:
> add per-class compact trace event - Minchan
>
> I put this patch from 1/8 to 8/8, since this patch depends on below patch:
> mm/zsmalloc: use obj_index to keep consistent with others
> mm/zsmalloc: take obj index back from find_alloced_obj
>
Thanks for looking into this, Ganesh!
Small change I want is to see the number of migrated object rather than
the number of scanning object.
If you don't mind, could you resend it with below?
Thanks.
diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
index 3a1315e54057..166232a0aed6 100644
--- a/mm/zsmalloc.c
+++ b/mm/zsmalloc.c
@@ -1774,7 +1774,7 @@ struct zs_compact_control {
* in the subpage. */
int obj_idx;
- unsigned long nr_scanned_obj;
+ unsigned long nr_migrated_obj;
unsigned long nr_freed_pages;
};
@@ -1809,6 +1809,7 @@ static int migrate_zspage(struct zs_pool *pool, struct size_class *class,
free_obj = obj_malloc(class, get_zspage(d_page), handle);
zs_object_copy(class, free_obj, used_obj);
obj_idx++;
+ cc->nr_migrated_obj++;
/*
* record_obj updates handle's value to free_obj and it will
* invalidate lock bit(ie, HANDLE_PIN_BIT) of handle, which
@@ -1821,8 +1822,6 @@ static int migrate_zspage(struct zs_pool *pool, struct size_class *class,
obj_free(class, used_obj);
}
- cc->nr_scanned_obj += obj_idx - cc->obj_idx;
-
/* Remember last position in this iteration */
cc->s_page = s_page;
cc->obj_idx = obj_idx;
@@ -2270,7 +2269,7 @@ static unsigned long zs_can_compact(struct size_class *class)
static void __zs_compact(struct zs_pool *pool, struct size_class *class)
{
struct zs_compact_control cc = {
- .nr_scanned_obj = 0,
+ .nr_migrated_obj = 0,
.nr_freed_pages = 0,
};
struct zspage *src_zspage;
@@ -2317,7 +2316,7 @@ static void __zs_compact(struct zs_pool *pool, struct size_class *class)
spin_unlock(&class->lock);
pool->stats.pages_compacted += cc.nr_freed_pages;
- trace_zs_compact(class->index, cc.nr_scanned_obj, cc.nr_freed_pages);
+ trace_zs_compact(class->index, cc.nr_migrated_obj, cc.nr_freed_pages);
}
unsigned long zs_compact(struct zs_pool *pool)
next prev parent reply other threads:[~2016-07-07 7:43 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-06 6:23 [PATCH v3 1/8] mm/zsmalloc: use obj_index to keep consistent with others Ganesh Mahendran
2016-07-06 6:23 ` Ganesh Mahendran
2016-07-06 6:23 ` [PATCH v3 2/8] mm/zsmalloc: take obj index back from find_alloced_obj Ganesh Mahendran
2016-07-06 6:23 ` Ganesh Mahendran
2016-07-06 6:23 ` [PATCH v3 3/8] mm/zsmalloc: use class->objs_per_zspage to get num of max objects Ganesh Mahendran
2016-07-06 6:23 ` Ganesh Mahendran
2016-07-06 6:23 ` [PATCH v3 4/8] mm/zsmalloc: avoid calculate max objects of zspage twice Ganesh Mahendran
2016-07-06 6:23 ` Ganesh Mahendran
2016-07-06 6:23 ` [PATCH v3 5/8] mm/zsmalloc: keep comments consistent with code Ganesh Mahendran
2016-07-06 6:23 ` Ganesh Mahendran
2016-07-06 6:23 ` [PATCH v3 6/8] mm/zsmalloc: add __init,__exit attribute Ganesh Mahendran
2016-07-06 6:23 ` Ganesh Mahendran
2016-07-06 8:01 ` kbuild test robot
2016-07-06 8:01 ` kbuild test robot
2016-07-06 8:06 ` kbuild test robot
2016-07-06 8:06 ` kbuild test robot
2016-07-06 8:20 ` Ganesh Mahendran
2016-07-06 8:20 ` Ganesh Mahendran
2016-07-06 6:23 ` [PATCH v3 7/8] mm/zsmalloc: use helper to clear page->flags bit Ganesh Mahendran
2016-07-06 6:23 ` Ganesh Mahendran
2016-07-06 6:23 ` [PATCH v3 8/8] mm/zsmalloc: add per-class compact trace event Ganesh Mahendran
2016-07-06 6:23 ` Ganesh Mahendran
2016-07-07 7:44 ` Minchan Kim [this message]
2016-07-07 7:44 ` Minchan Kim
2016-07-07 9:08 ` Ganesh Mahendran
2016-07-07 9:08 ` Ganesh Mahendran
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160707074420.GE18072@bbox \
--to=minchan@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mingo@redhat.com \
--cc=ngupta@vflare.org \
--cc=opensource.ganesh@gmail.com \
--cc=rostedt@goodmis.org \
--cc=sergey.senozhatsky.work@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.