summaryrefslogtreecommitdiffstats
path: root/mm/zsmalloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/zsmalloc.c')
-rw-r--r--mm/zsmalloc.c17
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,
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;
}
@@ -1711,9 +1717,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);