提交 6cbf16b3 编写于 作者: M Minchan Kim 提交者: Linus Torvalds

zsmalloc: use class->pages_per_zspage

There is no need to recalcurate pages_per_zspage in runtime.  Just use
class->pages_per_zspage to avoid unnecessary runtime overhead.
Signed-off-by: NMinchan Kim <minchan@kernel.org>
Acked-by: NSergey Senozhatsky <sergey.senozhatsky@gmail.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 ad9d5e17
......@@ -1723,7 +1723,7 @@ static unsigned long zs_can_compact(struct size_class *class)
obj_wasted /= get_maxobj_per_zspage(class->size,
class->pages_per_zspage);
return obj_wasted * get_pages_per_zspage(class->size);
return obj_wasted * class->pages_per_zspage;
}
static void __zs_compact(struct zs_pool *pool, struct size_class *class)
......@@ -1761,8 +1761,7 @@ static void __zs_compact(struct zs_pool *pool, struct size_class *class)
putback_zspage(pool, class, dst_page);
if (putback_zspage(pool, class, src_page) == ZS_EMPTY)
pool->stats.pages_compacted +=
get_pages_per_zspage(class->size);
pool->stats.pages_compacted += class->pages_per_zspage;
spin_unlock(&class->lock);
cond_resched();
spin_lock(&class->lock);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册