lkml.org 
[lkml]   [2015]   [Sep]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCHv2 3/3] zsmalloc: add compaction callbacks
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

\
 
 \ /
  Last update: 2015-09-26 10:41    [W:0.045 / U:0.644 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site