Commit ad9d5e17 authored by Minchan Kim's avatar Minchan Kim Committed by Linus Torvalds

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: default avatarMinchan Kim <minchan.kim@lge.com>
Acked-by: default avatarSergey Senozhatsky <sergey.senozhatsky@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 58f17117
...@@ -1691,11 +1691,17 @@ static enum fullness_group putback_zspage(struct zs_pool *pool, ...@@ -1691,11 +1691,17 @@ static enum fullness_group putback_zspage(struct zs_pool *pool,
static struct page *isolate_source_page(struct size_class *class) 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]; remove_zspage(page, class, i);
if (page) break;
remove_zspage(page, class, ZS_ALMOST_EMPTY); }
return page; return page;
} }
...@@ -1711,9 +1717,6 @@ static unsigned long zs_can_compact(struct size_class *class) ...@@ -1711,9 +1717,6 @@ static unsigned long zs_can_compact(struct size_class *class)
{ {
unsigned long obj_wasted; unsigned long obj_wasted;
if (!zs_stat_get(class, CLASS_ALMOST_EMPTY))
return 0;
obj_wasted = zs_stat_get(class, OBJ_ALLOCATED) - obj_wasted = zs_stat_get(class, OBJ_ALLOCATED) -
zs_stat_get(class, OBJ_USED); zs_stat_get(class, OBJ_USED);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment