All of lore.kernel.org
 help / color / mirror / Atom feed
* [nacked] zsmalloc-factor-out-zs_pages_to_compact.patch removed from -mm tree
@ 2015-07-14 18:31 akpm
  0 siblings, 0 replies; only message in thread
From: akpm @ 2015-07-14 18:31 UTC (permalink / raw)
  To: sergey.senozhatsky, minchan, mm-commits


The patch titled
     Subject: zsmalloc: factor out zs_pages_to_compact()
has been removed from the -mm tree.  Its filename was
     zsmalloc-factor-out-zs_pages_to_compact.patch

This patch was dropped because it was nacked

------------------------------------------------------
From: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Subject: zsmalloc: factor out zs_pages_to_compact()

Factor out the code that calculates how many pages compaction can free
into zs_pages_to_compact() function and export it as zsmalloc API symbol. 
We still use it in zs_shrinker_count(), just like we did before, and at
the same time we now let zram know this number (and provide it to user
space) so user space can make better assumptions about manual compaction
effectiveness.

Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: Minchan Kim <minchan@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 include/linux/zsmalloc.h |    1 
 mm/zsmalloc.c            |   39 +++++++++++++++++++++----------------
 2 files changed, 24 insertions(+), 16 deletions(-)

diff -puN include/linux/zsmalloc.h~zsmalloc-factor-out-zs_pages_to_compact include/linux/zsmalloc.h
--- a/include/linux/zsmalloc.h~zsmalloc-factor-out-zs_pages_to_compact
+++ a/include/linux/zsmalloc.h
@@ -53,6 +53,7 @@ void zs_unmap_object(struct zs_pool *poo
 
 unsigned long zs_get_total_pages(struct zs_pool *pool);
 unsigned long zs_compact(struct zs_pool *pool);
+unsigned long zs_pages_to_compact(struct zs_pool *pool);
 
 void zs_pool_stats(struct zs_pool *pool, struct zs_pool_stats *stats);
 #endif
diff -puN mm/zsmalloc.c~zsmalloc-factor-out-zs_pages_to_compact mm/zsmalloc.c
--- a/mm/zsmalloc.c~zsmalloc-factor-out-zs_pages_to_compact
+++ a/mm/zsmalloc.c
@@ -1798,6 +1798,28 @@ void zs_pool_stats(struct zs_pool *pool,
 }
 EXPORT_SYMBOL_GPL(zs_pool_stats);
 
+unsigned long zs_pages_to_compact(struct zs_pool *pool)
+{
+	unsigned long pages_to_free = 0;
+	int i;
+	struct size_class *class;
+
+	for (i = zs_size_classes - 1; i >= 0; i--) {
+		class = pool->size_class[i];
+		if (!class)
+			continue;
+		if (class->index != i)
+			continue;
+
+		spin_lock(&class->lock);
+		pages_to_free += zs_can_compact(class);
+		spin_unlock(&class->lock);
+	}
+
+	return pages_to_free;
+}
+EXPORT_SYMBOL_GPL(zs_pages_to_compact);
+
 static unsigned long zs_shrinker_scan(struct shrinker *shrinker,
 		struct shrink_control *sc)
 {
@@ -1819,28 +1841,13 @@ static unsigned long zs_shrinker_scan(st
 static unsigned long zs_shrinker_count(struct shrinker *shrinker,
 		struct shrink_control *sc)
 {
-	int i;
-	struct size_class *class;
-	unsigned long pages_to_free = 0;
 	struct zs_pool *pool = container_of(shrinker, struct zs_pool,
 			shrinker);
 
 	if (!pool->shrinker_enabled)
 		return 0;
 
-	for (i = zs_size_classes - 1; i >= 0; i--) {
-		class = pool->size_class[i];
-		if (!class)
-			continue;
-		if (class->index != i)
-			continue;
-
-		spin_lock(&class->lock);
-		pages_to_free += zs_can_compact(class);
-		spin_unlock(&class->lock);
-	}

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-07-14 18:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-14 18:31 [nacked] zsmalloc-factor-out-zs_pages_to_compact.patch removed from -mm tree akpm

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.