Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1233167

[PATCHv2 3/3] zsmalloc: add compaction callbacks

From Vitaly Wool <vitalywool@gmail.com>
Newsgroups linux.kernel
Subject [PATCHv2 3/3] zsmalloc: add compaction callbacks
Date 2015-09-26 10:20 +0200
Message-ID <qcSS6-2HF-5@gated-at.bofh.it> (permalink)
References <qcSIq-2wq-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Add compaction callbacks for zpool compaction API extension.

Signed-off-by: Vitaly Wool <vitalywool@gmail.com>
---
 mm/zsmalloc.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
index f135b1b..8f2ddd1 100644
--- a/mm/zsmalloc.c
+++ b/mm/zsmalloc.c
@@ -365,6 +365,19 @@ 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;
@@ -380,6 +393,8 @@ static struct zpool_driver zs_zpool_driver = {
 	.shrink =	zs_zpool_shrink,
 	.map =		zs_zpool_map,
 	.unmap =	zs_zpool_unmap,
+	.compact =	zs_zpool_compact,
+	.get_num_compacted =	zs_zpool_get_compacted,
 	.total_size =	zs_zpool_total_size,
 };
 
-- 
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCHv2 0/3] align zpool/zbud/zsmalloc on the api Vitaly Wool <vitalywool@gmail.com> - 2015-09-26 10:10 +0200
  [PATCHv2 3/3] zsmalloc: add compaction callbacks Vitaly Wool <vitalywool@gmail.com> - 2015-09-26 10:20 +0200
  Re: [PATCHv2 0/3] align zpool/zbud/zsmalloc on the api Minchan Kim <minchan@kernel.org> - 2015-09-30 10:10 +0200

csiph-web