aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorSergey Senozhatsky <sergey.senozhatsky@gmail.com>2015-09-08 18:04:24 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-09-08 18:35:28 -0400
commitb430d1fd6c7d22cc07e7c22a2ee1078667605313 (patch)
tree54b1a9bedc80489481967f8984ab4e649273c599 /mm
parentad5ea8cd5b934cc082f2cda900b490def149908e (diff)
zsmalloc: drop unused variable `nr_to_migrate'
This patchset tweaks compaction and makes it possible to trigger pool compaction automatically when system is getting low on memory. zsmalloc in some cases can suffer from a notable fragmentation and compaction can release some considerable amount of memory. The problem here is that currently we fully rely on user space to perform compaction when needed. However, performing zsmalloc compaction is not always an obvious thing to do. For example, suppose we have a `idle' fragmented (compaction was never performed) zram device and system is getting low on memory due to some 3rd party user processes (gcc LTO, or firefox, etc.). It's quite unlikely that user space will issue zpool compaction in this case. Besides, user space cannot tell for sure how badly pool is fragmented; however, this info is known to zsmalloc and, hence, to a shrinker. This patch (of 7): __zs_compact() does not use `nr_to_migrate', drop it. Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com> Acked-by: Minchan Kim <minchan@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/zsmalloc.c4
1 files changed, 0 insertions, 4 deletions
diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
index 0a7f81aa2249..7d816c2d74f9 100644
--- a/mm/zsmalloc.c
+++ b/mm/zsmalloc.c
@@ -1703,7 +1703,6 @@ static struct page *isolate_source_page(struct size_class *class)
1703static unsigned long __zs_compact(struct zs_pool *pool, 1703static unsigned long __zs_compact(struct zs_pool *pool,
1704 struct size_class *class) 1704 struct size_class *class)
1705{ 1705{
1706 int nr_to_migrate;
1707 struct zs_compact_control cc; 1706 struct zs_compact_control cc;
1708 struct page *src_page; 1707 struct page *src_page;
1709 struct page *dst_page = NULL; 1708 struct page *dst_page = NULL;
@@ -1714,8 +1713,6 @@ static unsigned long __zs_compact(struct zs_pool *pool,
1714 1713
1715 BUG_ON(!is_first_page(src_page)); 1714 BUG_ON(!is_first_page(src_page));
1716 1715
1717 /* The goal is to migrate all live objects in source page */
1718 nr_to_migrate = src_page->inuse;
1719 cc.index = 0; 1716 cc.index = 0;
1720 cc.s_page = src_page; 1717 cc.s_page = src_page;
1721 1718
@@ -1730,7 +1727,6 @@ static unsigned long __zs_compact(struct zs_pool *pool,
1730 1727
1731 putback_zspage(pool, class, dst_page); 1728 putback_zspage(pool, class, dst_page);
1732 nr_total_migrated += cc.nr_migrated; 1729 nr_total_migrated += cc.nr_migrated;
1733 nr_to_migrate -= cc.nr_migrated;
1734 } 1730 }
1735 1731
1736 /* Stop if we couldn't find slot */ 1732 /* Stop if we couldn't find slot */