diff options
author | Minchan Kim <minchan.kim@lge.com> | 2015-09-08 18:04:47 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-09-08 18:35:28 -0400 |
commit | ad9d5e175a77a253f52a7259a7c918b8351d99f1 (patch) | |
tree | a09a440e04adb26ea738fabf369ec71b3590e49f /mm/zsmalloc.c | |
parent | 58f171174625150f3aaad0cddd3e365270b8e1b8 (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/zsmalloc.c')
-rw-r--r-- | mm/zsmalloc.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index 615b9b9b45eb..c10885ca87a4 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c | |||
@@ -1691,11 +1691,17 @@ static enum fullness_group putback_zspage(struct zs_pool *pool, | |||
1691 | 1691 | ||
1692 | static struct page *isolate_source_page(struct size_class *class) | 1692 | static struct page *isolate_source_page(struct size_class *class) |
1693 | { | 1693 | { |
1694 | struct page *page; | 1694 | int i; |
1695 | struct page *page = NULL; | ||
1696 | |||
1697 | for (i = ZS_ALMOST_EMPTY; i >= ZS_ALMOST_FULL; i--) { | ||
1698 | page = class->fullness_list[i]; | ||
1699 | if (!page) | ||
1700 | continue; | ||
1695 | 1701 | ||
1696 | page = class->fullness_list[ZS_ALMOST_EMPTY]; | 1702 | remove_zspage(page, class, i); |
1697 | if (page) | 1703 | break; |
1698 | remove_zspage(page, class, ZS_ALMOST_EMPTY); | 1704 | } |
1699 | 1705 | ||
1700 | return page; | 1706 | return page; |
1701 | } | 1707 | } |
@@ -1711,9 +1717,6 @@ static unsigned long zs_can_compact(struct size_class *class) | |||
1711 | { | 1717 | { |
1712 | unsigned long obj_wasted; | 1718 | unsigned long obj_wasted; |
1713 | 1719 | ||
1714 | if (!zs_stat_get(class, CLASS_ALMOST_EMPTY)) | ||
1715 | return 0; | ||
1716 | |||
1717 | obj_wasted = zs_stat_get(class, OBJ_ALLOCATED) - | 1720 | obj_wasted = zs_stat_get(class, OBJ_ALLOCATED) - |
1718 | zs_stat_get(class, OBJ_USED); | 1721 | zs_stat_get(class, OBJ_USED); |
1719 | 1722 | ||