aboutsummaryrefslogtreecommitdiff
path: root/mm
diff options
context:
space:
mode:
authorMinchan Kim <minchan.kim@lge.com>2015-09-08 15:04:47 -0700
committerMister Oyster <oysterized@gmail.com>2017-09-25 21:00:59 +0200
commit651584a0ba6d3fe7da3bd597d7ed95214d7d8a8c (patch)
treef1a10d1c176f46dc2ffe7f102b4995f4b0cf8fe5 /mm
parent245ce030fb0922c68d7b07ca6d642a27f52e23f2 (diff)
zsmalloc: consider ZS_ALMOST_FULL as migrate source
There is no reason to prevent select ZS_ALMOST_FULL as migration source if we cannot find source from ZS_ALMOST_EMPTY. With this patch, zs_can_compact will return more exact result. Signed-off-by: Minchan Kim <minchan.kim@lge.com> Acked-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com> 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.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
index 9959ada13..02f93ae14 100644
--- a/mm/zsmalloc.c
+++ b/mm/zsmalloc.c
@@ -1682,11 +1682,17 @@ static enum fullness_group putback_zspage(struct zs_pool *pool,
static struct page *isolate_source_page(struct size_class *class)
{
- struct page *page;
+ int i;
+ struct page *page = NULL;
+
+ for (i = ZS_ALMOST_EMPTY; i >= ZS_ALMOST_FULL; i--) {
+ page = class->fullness_list[i];
+ if (!page)
+ continue;
- page = class->fullness_list[ZS_ALMOST_EMPTY];
- if (page)
- remove_zspage(page, class, ZS_ALMOST_EMPTY);
+ remove_zspage(page, class, i);
+ break;
+ }
return page;
}
@@ -1702,9 +1708,6 @@ static unsigned long zs_can_compact(struct size_class *class)
{
unsigned long obj_wasted;
- if (!zs_stat_get(class, CLASS_ALMOST_EMPTY))
- return 0;
-
obj_wasted = zs_stat_get(class, OBJ_ALLOCATED) -
zs_stat_get(class, OBJ_USED);