From: Minchan Kim Date: Wed, 15 Apr 2015 23:16:18 +0000 (-0700) Subject: zsmalloc: remove unnecessary insertion/removal of zspage in compaction X-Git-Tag: firefly_0821_release~176^2~1961^2~45 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=839373e645d12613308d9148041c4bd967bce8d5;p=firefly-linux-kernel-4.4.55.git zsmalloc: remove unnecessary insertion/removal of zspage in compaction In putback_zspage, we don't need to insert a zspage into list of zspage in size_class again to just fix fullness group. We could do directly without reinsertion so we could save some instuctions. Reported-by: Heesub Shin Signed-off-by: Minchan Kim Cc: Nitin Gupta Cc: Sergey Senozhatsky Cc: Dan Streetman Cc: Seth Jennings Cc: Ganesh Mahendran Cc: Luigi Semenzato Cc: Gunho Lee Cc: Juneho Choi Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index a9a9ff233a13..ded3672295d7 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -1678,14 +1678,14 @@ static struct page *alloc_target_page(struct size_class *class) static void putback_zspage(struct zs_pool *pool, struct size_class *class, struct page *first_page) { - int class_idx; enum fullness_group fullness; BUG_ON(!is_first_page(first_page)); - get_zspage_mapping(first_page, &class_idx, &fullness); + fullness = get_fullness_group(first_page); insert_zspage(first_page, class, fullness); - fullness = fix_fullness_group(class, first_page); + set_zspage_mapping(first_page, class->index, fullness); + if (fullness == ZS_EMPTY) { zs_stat_dec(class, OBJ_ALLOCATED, get_maxobj_per_zspage( class->size, class->pages_per_zspage));