From: Vitaly Wool <vitalywool@gmail.com>
To: Linux-MM <linux-mm@kvack.org>,
Andrew Morton <akpm@linux-foundation.org>,
Dan Streetman <ddstreet@ieee.org>,
Minchan Kim <minchan@kernel.org>
Cc: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>,
LKML <linux-kernel@vger.kernel.org>,
Vlastimil Babka <vbabka@suse.cz>,
Shakeel Butt <shakeelb@google.com>,
Henry Burns <henrywolfeburns@gmail.com>,
Theodore Ts'o <tytso@thunk.org>
Subject: [PATCH 2/3] zsmalloc: add compaction and huge class callbacks
Date: Thu, 10 Oct 2019 23:11:43 +0300 [thread overview]
Message-ID: <20191010231143.09e4a2bd52f331efd0c4baf9@gmail.com> (raw)
In-Reply-To: <20191010230414.647c29f34665ca26103879c4@gmail.com>
Add compaction callbacks for zpool compaction API extension.
Add huge_class_size callback too to be fully aligned.
With these in place, we can proceed with ZRAM modification
to use the universal (zpool) API.
Signed-off-by: Vitaly Wool <vitalywool@gmail.com>
---
mm/zsmalloc.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
index 2b2b9aae8a3c..43f43272b998 100644
--- a/mm/zsmalloc.c
+++ b/mm/zsmalloc.c
@@ -437,11 +437,29 @@ static void zs_zpool_unmap(void *pool, unsigned long handle)
zs_unmap_object(pool, handle);
}
+static unsigned long zs_zpool_compact(void *pool)
+{
+ return zs_compact(pool);
+}
+
+static unsigned long zs_zpool_get_compacted(void *pool)
+{
+ struct zs_pool_stats stats;
+
+ zs_pool_stats(pool, &stats);
+ return stats.pages_compacted;
+}
+
static u64 zs_zpool_total_size(void *pool)
{
return zs_get_total_pages(pool) << PAGE_SHIFT;
}
+static size_t zs_zpool_huge_class_size(void *pool)
+{
+ return zs_huge_class_size(pool);
+}
+
static struct zpool_driver zs_zpool_driver = {
.type = "zsmalloc",
.owner = THIS_MODULE,
@@ -453,6 +471,9 @@ static struct zpool_driver zs_zpool_driver = {
.map = zs_zpool_map,
.unmap = zs_zpool_unmap,
.total_size = zs_zpool_total_size,
+ .compact = zs_zpool_compact,
+ .get_num_compacted = zs_zpool_get_compacted,
+ .huge_class_size = zs_zpool_huge_class_size,
};
MODULE_ALIAS("zpool-zsmalloc");
--
2.20.1
next prev parent reply other threads:[~2019-10-10 20:11 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-10 20:04 [PATCH 0/3] Allow ZRAM to use any zpool-compatible backend Vitaly Wool
2019-10-10 20:09 ` [PATCH 1/3] zpool: extend API to match zsmalloc Vitaly Wool
2019-10-18 11:23 ` Dan Streetman
2019-10-10 20:11 ` Vitaly Wool [this message]
2019-10-14 10:38 ` [PATCH 2/3] zsmalloc: add compaction and huge class callbacks Sergey Senozhatsky
2019-10-10 20:20 ` [PATCH 3/3] zram: use common zpool interface Vitaly Wool
2019-10-14 10:47 ` Sergey Senozhatsky
2019-10-14 11:52 ` Vitaly Wool
2019-10-15 2:04 ` Sergey Senozhatsky
2019-10-14 10:33 ` [PATCH 0/3] Allow ZRAM to use any zpool-compatible backend Sergey Senozhatsky
2019-10-14 11:49 ` Vitaly Wool
2019-10-14 16:41 ` Minchan Kim
2019-10-15 7:39 ` Vitaly Wool
2019-10-15 20:00 ` Minchan Kim
2019-10-21 14:21 ` Vitaly Wool
2019-10-30 0:10 ` Minchan Kim
2019-11-13 15:54 ` Vitaly Wool
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=20191010231143.09e4a2bd52f331efd0c4baf9@gmail.com \
--to=vitalywool@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=ddstreet@ieee.org \
--cc=henrywolfeburns@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=minchan@kernel.org \
--cc=sergey.senozhatsky.work@gmail.com \
--cc=shakeelb@google.com \
--cc=tytso@thunk.org \
--cc=vbabka@suse.cz \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).